g++ compilation header difficulties (where are they?)

Russell Martin martin@dcs.warwick.ac.uk
Wed Apr 27 17:25:00 GMT 2005


Hello,

I've recently re-installed cygwin in an attempt to fix my problem,
but that didn't help.  I should point out in what follows that I'm
somewhat familiar with using Unix, but am not at all familiar with
the installation/maintenance procedures for Unix platforms.  After a
search through the last six to eight months of the mailing list
archives, I haven't found anything that seems particularly relevant.


I'm having trouble compiling using g++.  There are two problems, one
that is easily avoided because it's really a warning.

Here is an example of the first error....

$ g++ test.cpp
In file included from /usr/include/c++/3.3.3/backward/iostream.h:31,
                  from test.cpp:2:
/usr/include/c++/3.3.3/backward/backward_warning.h:32:2: warning: 
#warning This file includes at least one deprecated or antiquated
header. Please consider using one of the 32 headers found in section
17.4.1.2 of the C++ standard. Examples include substituting the <X>
header for the <X.h> header for C++ includes, or <sstream> instead of
the deprecated header <strstream.h>. To disable this warning use 
-Wno-deprecated.

-----
This code (which I don't include here) compiles correctly.  I'm
using the headers "stdlib.h", "iostream.h" and "fstream.h" in this
particular code.  As it states, I'm using the deprecated headers, a
warning that is easily avoided by using the -Wno-deprecated option.
Upon inspection, I don't appear to have the new (non-deprecated) header
files anywhere in my installation.  Trying to use #include<stdlib> in my
program only results in a "No such file or directory" error.  Using
"find", I can only locate (for example) "stdlib.h" and there is no file
"stdlib" anywhere.  I do have a file "iostream" in the
/use/include/c++/3.3.3 directory, but the compiler can't seem to locate 
it (more on that below) as it clearly states in the warning above.
Is there any solution to this problem?  Is there a source for
downloading the header files compatible with my version (3.3.3) of g++?

I've had a quick look at gcc.gnu.org and I see that they have versions 
3.4.3 and 3.4.0 available.  One option, I suppose, is to try to install
a new version, but I doubt my ability to configure it correctly upon
installation.


Here's an example of the second problem where I try to use the "string"
class in a program.

$ g++ -Wno-deprecated -v euler.cpp
Reading specs from /usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/specs
Configured with: /gcc/gcc-3.3.3-3/configure --verbose --prefix=/usr 
--exec-prefix=/usr --sysconfdir=/etc --libdir=/usr/lib 
--libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info 
--enable-languages=c,ada,c++,d,f77,java,objc,pascal --enable-nls 
--without-included-gettext --enable-libgcj --with-system-zlib
--enable-interpreter --enable-threads=posix --enable-java-gc=boehm 
--enable-sjlj-exceptions --disable-version-specific-runtime-libs 
--disable-win32-registry
Thread model: posix
gcc version 3.3.3 (cygwin special)
  /usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/cc1plus.exe -quiet -v 
-D__GNUC__=3 -D__GN
UC_MINOR__=3 -D__GNUC_PATCHLEVEL__=3 -D__CYGWIN32__ -D__CYGWIN__ -Dunix 
-D__unix
__ -D__unix -idirafter 
/usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/../../../../include
/w32api -idirafter 
/usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/../../../../i686-pc-cyg
win/lib/../../include/w32api euler.cpp -D__GNUG__=3 -quiet -dumpbase 
euler.cpp -
auxbase euler -Wno-deprecated -version -o 
/cygdrive/c/DOCUME~1/Russell/LOCALS~1/
Temp/ccHGdHXg.s
GNU C++ version 3.3.3 (cygwin special) (i686-pc-cygwin)
         compiled by GNU C version 3.3.3 (cygwin special).
GGC heuristics: --param ggc-min-expand=64 --param ggc-min-heapsize=65405
ignoring nonexistent directory "/usr/local/include"
ignoring nonexistent directory "/usr/i686-pc-cygwin/include"
ignoring duplicate directory "/usr/i686-pc-cygwin/lib/../../include/w32api"
#include "..." search starts here:
#include <...> search starts here:
  /usr/include/c++/3.3.3
  /usr/include/c++/3.3.3/i686-pc-cygwin
  /usr/include/c++/3.3.3/backward
  /usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/include
  /usr/include
  /usr/include/w32api
End of search list.
euler.cpp: In function `int main(int, char**)':
euler.cpp:21: error: `string' undeclared (first use this function)
euler.cpp:21: error: (Each undeclared identifier is reported only once 
for each function it appears in.)
euler.cpp:21: error: parse error before `;' token

-----
Despite the fact that the header file "string" is located in the 
directory /usr/include/c++/3.3.3 the compiler seemingly can't locate
it.  This is puzzling since it lists this path in the #include
search path above.  Even placing the source code into the
/usr/include/c++/3.3.3 directory and trying to compile it there gives
the same error.  What am I overlooking here, or not understanding?

Also, the comments reported in the output suggest that the "specs"
file may not be entirely up to snuff with the installation on my
machine since it's reporting non-existent directories that it
is ignoring.  As a reminder, I just completely re-installed cygwin
today (after an uninstall), so I haven't been mucking about with
the directory structure.

Many thanks in advance.  Find attached my "cygcheck.out" file.

Puzzled,

Russ
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: cygcheck.out
URL: <http://cygwin.com/pipermail/cygwin/attachments/20050427/e78d6025/attachment.ksh>
-------------- next part --------------
--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


More information about the Cygwin mailing list