Help needed compiling using gcc

Martin v. Loewis martin@loewis.home.cs.tu-berlin.de
Wed Apr 19 14:56:00 GMT 2000


> Hi, I was wondering if someone can help me. When I try compiling .c or
> .cc files I get error messages saying iostream.h  ---FILE NOT found.

When you compile a C file, iostream.h is not in the include path: that
is a C++ header, only. If a file has a .c extension, gcc will treat it
as a C file.

>  bash$ gcc  Test.cc
> /tmp/ccx26951.o: In function `main':
> /tmp/ccx26951.o(.text+0xf): undefined reference to `cout'

Here, you really should compile the program using 'g++' instead of
'gcc', since that will link the standard C++ library.

Regards,
Martin



More information about the Gcc-help mailing list