Mail Archives: djgpp/1999/06/25/14:38:49
RPLATLANTA wrote:
>
> with the code:
>
> #include <iostream.h>
>
> int main();
> int main ()
> {
> cout << "Hello World!\n";
> return 0;
> }
>
> i typed:
>
> gcc hello.cpp -o hello.exe
>
> and received the error message:
>
> C:\WINDOWS\TEMP\cccyeivk(.text+0x19):hello.cpp: undefined reference to 'cout'
> C:\WINDOWS\TEMP\cccyeivk(.text+0x1e):hello.cpp: undefined reference to
> 'ostream::operator<<(char const *)'
>
> could someone please tell me what to do? thanks.
cout is a c++ call and you are compiling with the regular 'C' compiler.
To get that program to work you need to use 'gxx'. (e.g instead of gcc
hello.cpp -o hello.exe try gxx hello.cpp -o hello.exe) If your computer
doesn't know what gxx is or it has problems you need to download
gpp281b.zip from the simtel archive, then unzip it (if with pkunzip use
the -d flag) in your djgpp directory and try to compile with gxx again.
- Raw text -