C headers break C++ headers
Curtis L. Janssen
cljanss@aros.ca.sandia.gov
Mon Dec 11 13:15:00 GMT 2000
The following two line code (inc.cc) fails using a recent CVS gcc:
#include <stdio.h>
#include <iostream>
It should be legal (stdio.h is accepted as a deprecated feature
in ISO 14882). The problem is that _ISOC99_SOURCE isn't defined
before stdio.h is included and, thus, lldiv_t isn't defined. Add
-D_ISO99_SOURCE=1 to the command line and it works fine.
Reversing the order of the includes also fixes the problem.
compiler: from CVS directory on 2000/12/10
libc: 2.1.3
% c++ -v -c inc.cc
Reading specs from /usr/local/gcc-cvs/lib/gcc-lib/i686-pc-linux-gnu/2.97/specs
Configured with: /home/cljanss/src/gnu/gcc/configure --enable-threads --prefix=/usr/local/gcc-cvs
gcc version 2.97 20001210 (experimental)
/usr/local/gcc-cvs/lib/gcc-lib/i686-pc-linux-gnu/2.97/cc1plus -v -D__GNUC__=2 -D__GNUC_MINOR__=97 -D__GNUC_PATCHLEVEL__=0 -D__ELF__ -Dunix -Dlinux -D__ELF__ -D__unix__ -D__linux__ -D__unix -D__linux -Asystem=posix -D__STDC_HOSTED__=1 -Acpu=i386 -Amachine=i386 -Di386 -D__i386 -D__i386__ -D__tune_i686__ -D__tune_pentiumpro__ inc.cc -D__GNUG__=2 -D__GXX_ABI_VERSION=100 -quiet -dumpbase inc.cc -version -fnew-abi -o /tmp/cc1gY27G.s
GNU CPP version 2.97 20001210 (experimental) (cpplib) (i386 Linux/ELF)
GNU C++ version 2.97 20001210 (experimental) (i686-pc-linux-gnu) compiled by GNU C version 2.97 20001210 (experimental).
#include "..." search starts here:
#include <...> search starts here:
/usr/local/gcc-cvs/include/g++-v3
/usr/local/include
/usr/local/gcc-cvs/lib/gcc-lib/i686-pc-linux-gnu/2.97/include
/usr/local/gcc-cvs/i686-pc-linux-gnu/include
/usr/include
End of search list.
In file included from /usr/local/gcc-cvs/include/g++-v3/bits/stl_alloc.h:53,
from /usr/local/gcc-cvs/include/g++-v3/bits/stl_string_fwd.h:18,
from /usr/local/gcc-cvs/include/g++-v3/bits/std_ios.h:40,
from /usr/local/gcc-cvs/include/g++-v3/bits/std_ostream.h:1,
from /usr/local/gcc-cvs/include/g++-v3/bits/std_iostream.h:38,
from /usr/local/gcc-cvs/include/g++-v3/iostream:1,
from inc.cc:3:
/usr/local/gcc-cvs/include/g++-v3/bits/std_cstdlib.h:51: `lldiv_t' not declared
/usr/local/gcc-cvs/include/g++-v3/bits/std_cstdlib.h:102: syntax error before `
(' token
/usr/local/gcc-cvs/include/g++-v3/bits/std_cstdlib.h:103: syntax error before `
.' token
/usr/local/gcc-cvs/include/g++-v3/bits/std_cstdlib.h:103: syntax error before `
.' token
/usr/local/gcc-cvs/include/g++-v3/bits/std_cstdlib.h:106: syntax error before `
(' token
/usr/local/gcc-cvs/include/g++-v3/bits/std_cstdlib.h:107: syntax error before `
.' token
/usr/local/gcc-cvs/include/g++-v3/bits/std_cstdlib.h:107: syntax error before `
.' token
/usr/local/gcc-cvs/include/g++-v3/bits/std_cstdlib.h:109: declaration of `long
long int atoll(const char*)' throws different exceptions
/usr/include/stdlib.h:92: than previous declaration `long long int atoll(const
char*) throw ()'
/usr/local/gcc-cvs/include/g++-v3/bits/std_cstdlib.h:110: declaration of `long
long int strtoll(const char*, char**, int)' throws different exceptions
/usr/include/stdlib.h:134: than previous declaration `long long int
strtoll(const char*, char**, int) throw ()'
/usr/local/gcc-cvs/include/g++-v3/bits/std_cstdlib.h:111: declaration of `long
long unsigned int strtoull(const char*, char**, int)' throws different
exceptions
/usr/include/stdlib.h:139: than previous declaration `long long unsigned int
strtoull(const char*, char**, int) throw ()'
/usr/local/gcc-cvs/include/g++-v3/bits/std_cstdlib.h:117: parse error before `}
' token
Curt
-----------------------------------------------------------------------
Curtis Janssen
cljanss@ca.sandia.gov http://aros.ca.sandia.gov/~cljanss
Tel: +1 925-294-1509 Fax: +1 925-294-2234
Sandia National Labs, MS 9217, PO Box 969, Livermore, CA 94551, USA
More information about the Libstdc++
mailing list