This is the mail archive of the gcc-help@gcc.gnu.org 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]

Re: Problems compiing with g++ / c++


"Anthony R. Mattke" <tonhe at adelphia dot net> writes:

> I have a older slack 8 install on my desktop that has been giving me
> trouble for a couple months. 
> 
> Neithier c++ or g++ can seem to find their own headers anymore in
> /usr/include/g++-3 Does anyone have any clue why this would be ?

The headers provided in <prefix>/include/g++-3 where an interim
    solution to the fact that gcc did not (during the gcc 2.9
    timeframe) have an implementation of the standard C++ library.

Starting with gcc 3.0, gcc now provides an implementation of the
    standard C++ library. It is however provided in a different
    (version-specific) directory.

The g++-3 directory is not used by any gcc 3.0 or greater.

> 
> Here is a partial output from a failed build of mozilla from last
> night.. 
> 
> Thanks in advance for the help.
> 
> g++ -o TestCOMPtr.o -c -DOSTYPE=\"Linux2.4\" -DOSARCH=\"Linux\" -DOJI
> -I./../ds
> -I./services  -I../../dist/include/string -I../../dist/include/xpcom
> -I../../dist/include -I/root/mozilla/dist/include/nspr     
> -I/usr/X11R6/include   -fPIC  -I/usr/X11R6/include -fno-rtti
> -fno-exceptions -Wall -Wconversion -Wpointer-arith -Wcast-align
> -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -pedantic
> -Wno-long-long -pthread -pipe  -DDEBUG -D_DEBUG -DDEBUG_root -DTRACING
> -g -fno-inline  -I/usr/X11R6/include -DMOZILLA_CLIENT -include
> ../../mozilla-config.h -Wp,-MD,.deps/TestCOMPtr.pp TestCOMPtr.cpp
> TestCOMPtr.cpp:39: iostream.h: No such file or directory

iostream.h is not part of standard C++. You must complain to the
    mozilla people; they must use <iostream> instead. 

For the near-term, install gcc-2.95.3 alongside of your newer
    compiler, and projects which cannot be built with the newer
    compiler should be built with the old one.

> TestCOMPtr.cpp: In method `test_message::test_message()':
> TestCOMPtr.cpp:104: `cout' undeclared (first use this function)
> TestCOMPtr.cpp:104: (Each undeclared identifier is reported only once
> TestCOMPtr.cpp:104: for each function it appears in.)
> TestCOMPtr.cpp:104: `endl' undeclared (first use this function)

cout and endl are in the std namespace, and proper qualifiers, using
    directives, or using declarations are required.

gcc-2.95.x accepted:

    #include<iostream>
    using std::cout;
    using std::endl;

along with older, pre-standard constructs in order to provide
    developers with time to migrate. But newer gccs require the above,
    and no loonger accept pre-standard stuff.

> make[3]: *** [TestCOMPtr.o] Error 1
> make[3]: Leaving directory `/server/root/mozilla/xpcom/tests'
> make[2]: *** [libs] Error 2
> make[2]: Leaving directory `/server/root/mozilla/xpcom'
> make[1]: *** [tier_2] Error 2
> make[1]: Leaving directory `/server/root/mozilla'
> make: *** [default] Error 2


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