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]

RE: building gcc-2.95.2 with libstdc++-2.90.8 library on RH 6.2


Manjunath H Bhajantri wrote:

> But I am not able to build properly. Because my HelloWorld.cxx
> "#include <iostream.h> int main() { cout <<"Hello, World!"<<endl;}"
> is not compiling, giving the error /tmp/ccGZV1Sn.o: In function
`main':
> /tmp/ccGZV1Sn.o(.text+0xa): undefined reference to `endl(ostream &)'

You're using:

    gcc HelloWorld.cxx

when you should be using:

    g++ HelloWorld.cxx

The g++ compiler driver will automatically link in the necessary C++
libraries.

There are no namespace problems with this code. However, <iostream.h>
has been deprecated in GCC 3.0+ in favour of <iostream> (which defines
everything in the 'std' namespace).

Hope that helps,
Rup.




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