From: bd733 AT rgfn DOT epcc DOT edu (Jason M. Daniels) Newsgroups: comp.os.msdos.djgpp Subject: Re: undefined ref to 'cout' Date: 25 Jun 1997 16:50:08 GMT Organization: The Rio Grande Free-Net, El Paso Community College, El Paso, TX Lines: 43 Message-ID: <5ori80$84e@news.epcc.edu> References: NNTP-Posting-Host: rgfn.epcc.edu To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk 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 > 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.