[Bug libstdc++/35557] New: including <iostream> pulls symbols from unistd.h in global namespace
arnaud dot boulan at esterel-technologies dot com
gcc-bugzilla@gcc.gnu.org
Wed Mar 12 17:14:00 GMT 2008
While trying to compile this test program:
// begin
int write;
#include <iostream>
int main()
{ return 0; }
// end
i got the following error message:
====================
$ g++ -Wall test.cpp
In file included from
/usr/lib/gcc/i386-redhat-linux/3.4.3/../../../../include/c++/3.4.3/i386-redhat-linux/bits/gthr-default.h:44,
from
/usr/lib/gcc/i386-redhat-linux/3.4.3/../../../../include/c++/3.4.3/i386-redhat-linux/bits/gthr.h:104,
from
/usr/lib/gcc/i386-redhat-linux/3.4.3/../../../../include/c++/3.4.3/i386-redhat-linux/bits/c++io.h:37,
from
/usr/lib/gcc/i386-redhat-linux/3.4.3/../../../../include/c++/3.4.3/iosfwd:47,
from
/usr/lib/gcc/i386-redhat-linux/3.4.3/../../../../include/c++/3.4.3/ios:44,
from
/usr/lib/gcc/i386-redhat-linux/3.4.3/../../../../include/c++/3.4.3/ostream:45,
from
/usr/lib/gcc/i386-redhat-linux/3.4.3/../../../../include/c++/3.4.3/iostream:45,
from test.cpp:4:
/usr/include/unistd.h:318: error: `ssize_t write(int, const void*, size_t)'
redeclared as different kind of symbol
test.cpp:2: error: previous declaration of `int write'
test.cpp:2: error: previous non-function declaration `int write'
/usr/include/unistd.h:318: error: conflicts with function declaration `ssize_t
write(int, const void*, size_t)'
$ g++ -v
Reading specs from /usr/lib/gcc/i386-redhat-linux/3.4.3/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--disable-checking --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-java-awt=gtk --host=i386-redhat-linux
Thread model: posix
gcc version 3.4.3 20050227 (Red Hat 3.4.3-22.1)
$ cat /etc/redhat-release
Red Hat Enterprise Linux ES release 4 (Nahant Update 1)
====================
this problem also happens with gcc 4.1.2
including <iostream> should not trigger the inclusion of unistd.h symbols in
global namespace.
the program compiles fine with gcc 3.2.3
--
Summary: including <iostream> pulls symbols from unistd.h in
global namespace
Product: gcc
Version: 3.4.3
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: arnaud dot boulan at esterel-technologies dot com
GCC build triplet: i386-redhat-linux
GCC host triplet: i386-redhat-linux
GCC target triplet: i386-redhat-linux
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35557
More information about the Gcc-bugs
mailing list