Mail Archives: djgpp/1998/08/29/12:11:41
This happens because you forgot to link your program with C++
library. Try this: "gcc hello.cpp -o hello.exe -lm -lstdcxx"
Holger wrote:
> Hello All !
>
> I've just downloaded DJGPP V2 and installed it on my OS/2-System. But
>I'm quite new to C++ and have some problems with compiling the following
>program, which works fine with IBM C-Set:
>
> #include <iostream.h>
> int main(void) {
> cout << "Hello World";
> }
>
> When compiling it with "gcc hello.cpp -o hello.exe -lm" I get the
>following error:
>
> c:/prg/anw/djgpp/tmp\cccanohi(.text+0x15):hello.cpp: undefined
>reference to `cout'
> c:/prg/anw/djgpp/tmp\cccanohi(.text+0x1a):hello.cpp: undefined
reference to `ostream::operator<<(char const *)'
>
> If I use "printf" instead of "cout" everything works fine. Is this an
DJGPP problem or am I just to stupid to write a simple cpp-program ?
>
> Holger
>
>---
>Jerakeen @ gmx.net
>Holger Merk @ 2:2443/2011.12
>http://online-club.de/m1/Jerakeen
>## CrossPoint v3.11 R ##
>
>
- Raw text -