This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

c++/6789: Error including 'fstream' on Solaris 2.6

>Number:         6789
>Category:       c++
>Synopsis:       Error including 'fstream' on Solaris 2.6
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Thu May 23 16:26:01 PDT 2002
>Release:        unknown-1.0
SunOS hutt 5.6 Generic_105181-30 sun4u sparc SUNW,Ultra-Enterprise
When the program includes <fstream> the <prefix>/include/g++-v3/bits/basic_file.h is included before the <prefix>/include/g++-v3/sparc-sun-solaris2.6/bits/basic_file.h, causing the compiler to not to recognise the typedef __c_file. The order of include search seems to be wrong. The text below shows the full output from a simple compile session.

n179339:programs$ g++ -v -c hello_world.cpp 
Reading specs from /home/ap_share/lib/gcc-lib/sparc-sun-solaris2.6/3.1/specs
Configured with: ../gcc-3.1/configure --prefix=/home/ap_share --enable-languages=c,c++,java --with-gnu-ld --with-ld=/home/ap_share/bin/gnu-ld --with-gnu-as --with-as=/home/ap_share/bin/gnu-as
Thread model: posix
gcc version 3.1
 /home/ap_share/lib/gcc-lib/sparc-sun-solaris2.6/3.1/cc1plus -v -D__GNUC__=3 -D__GNUC_MINOR__=1 -D__GNUC_PATCHLEVEL__=0 -Dsparc -Dsun -Dunix -D__svr4__ -D__SVR4 -D__PRAGMA_REDEFINE_EXTNAME -D__sparc__ -D__sun__ -D__unix__ -D__svr4__ -D__SVR4 -D__PRAGMA_REDEFINE_EXTNAME -D__sparc -D__sun -D__unix -Asystem=unix -Asystem=svr4 -D__NO_INLINE__ -D__STDC_HOSTED__=1 -D_XOPEN_SOURCE=500 -D_LARGEFILE_SOURCE=1 -D_LARGEFILE64_SOURCE=1 -D__EXTENSIONS__ -D__GCC_NEW_VARARGS__ -Acpu=sparc -Amachine=sparc hello_world.cpp -D__GNUG__=3 -D__DEPRECATED -D__EXCEPTIONS -D__GXX_ABI_VERSION=100 -quiet -dumpbase hello_world.cpp -version -o /var/tmp//ccdEbzWL.s
GNU CPP version 3.1 (cpplib) (sparc ELF)
GNU C++ version 3.1 (sparc-sun-solaris2.6)
        compiled by GNU C version 3.1.
#include "..." search starts here:
#include <...> search starts here:
End of search list.
 /home/ap_share/bin/gnu-as --traditional-format -V -Qy -s -o hello_world.o /var/tmp//ccdEbzWL.s
GNU assembler version 2.12 (sparc-sun-solaris2.6) using BFD version 2.12
Just say:

#include <fstream>

at the top of your source, and try compiling.
Temporary fix:

Renamed the <prefix>/include/g++-v3/bits/basic_file.h to something else (or remove it completely) and the one from the platform include directory will be picked up.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]