Mail Archives: djgpp/1997/06/26/06:02:14
Laura Morris (chelcmx AT panther DOT Gsu DOT EDU) wrote:
> Hello All,
> I just installed DJGPP on my system at home and I've come up with a weird
> error. I tried this simple little program below:
> ---------------------------
> #include <iostream.h>
> void main(void)
> {
> cout << "hello";
> }
> ----------------------------
> When I tried to compile it (gcc -o output.exe sample.cc) I received the
> following error:
> undefined reference to 'cout'
> undefined reference to 'ostream:operator<<(char const *)'
> I have no idea what this means but I do have lgp271b.zip installed under
> c:\djgpp and iostream.h is in the lang/cxx directory.
> I would appreciate any suggestions.
If this exact question isn't in the FAQ it should be. The problem is that
you aren't linking the iostreams library in with your program. You have
two options:
compile with gxx (fx, gxx sample.cc -o sample.exe) which effectively
forces your program into the GPL (i think)
link with the stand-alone iostreams library (fx, gcc sample.cc -o
sample.exe -liostr)
hth!
--
Jason Daniels -- bd733 AT rgfn DOT epcc DOT edu
---> BELIEVE THE LIE <---
Linux: The choice of a GNU generation.
Winblows 95: The world's best-selling computer virus.
- Raw text -