gcc won't compile

Claudio Bley bley@cs.uni-magdeburg.de
Tue Nov 27 11:33:00 GMT 2001


>>>>> "Gabi" == Gabi Bakray <gabi@hadassah.org.il> writes:

    Gabi> Hi, I installed gcc3.0.1 SPARC/Solaris 8 binary freeware
    Gabi> package.

    Gabi> g++ compiles a "helo world" program just fine, but when I
    Gabi> try to run gcc I get a very long error message starting
    Gabi> with:

    Gabi> /var/tmp/ccY1oxXs.o: In function `main':
    Gabi> /var/tmp/ccY1oxXs.o(.text+0x1ac): undefined reference to
    Gabi> `std::cout' .  .  .

    Gabi> What's wrong?


    Gabi> Sincerely,

    Gabi> Gabi Barkay

Hi.

Generally, if you want to compile a C++ program, just use g++.

Albeit gcc will determine the language from the file extension
(e.g. .C .cpp .cc .c++ for C++) it will not link with the necessary
standard C++ library libstdc++ and hence it will usually fail.

Compiling C programs with gcc should work fine.


Claudio



More information about the Gcc-help mailing list