Xref: news-dnh.mv.net comp.os.msdos.djgpp:2360 Newsgroups: comp.os.msdos.djgpp Path: news-dnh.mv.net!mv!news.NH.Destek.Net!news2.net99.net!news.cais.net!uunet!in1.uu.net!news.mathworks.com!news.kei.com!simtel!news.sprintlink.net!howland.reston.ans.net!news.nic.surfnet.nl!sun4nl!cs.vu.nl!rjvdboon From: rjvdboon AT cs DOT vu DOT nl (Boon van der RJ) Subject: Re: can't compile c++ Nntp-Posting-Host: jol41.cs.vu.nl References: Sender: news AT cs DOT vu DOT nl Organization: Fac. Wiskunde & Informatica, VU, Amsterdam Date: Tue, 3 Oct 1995 09:09:02 GMT Lines: 34 To: djgpp AT sun DOT soe DOT clarkson DOT edu Dj-Gateway: from newsgroup comp.os.msdos.djgpp Chris A. Rodgers (car AT wwa DOT com) wrote: : I tried to compile the following source code (myfirst.cpp): : // myfirst.cpp--displays a message : #include // a PREPROCESSOR directive : int main(void) : { : cout << "Come up and C++ me some time."; : cout << "\n"; : return 0; : } : This is the result of compilation: : E:\DJGPP\SRC\cis_230\testbed1>gcc -v myfirst.cpp : Reading specs from e:/djgpp/lib\specs : gcc version 2.6.3 : e:/djgpp/bin\cpp.exe -lang-c++ -v -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplu : s -D__GNUC_MINOR__=6 -Dunix -Di386 -DGO32 -DMSDOS -D__unix__ -D__i386__ -D__GO32 : __ -D__MSDOS__ -D__unix -D__i386 -D__GO32 -D__MSDOS myfirst.cpp e:/djgpp/tmp\cc0 : gcc -lc -lgcc In my case (I've also been struggling with this) gcc -lgpp worked fine. no other options required for such a simple program. ( After searching for hours I found it in some doc somewhere) : myfirst.cc(.text+0x2e): undefined reference to `cout' : myfirst.cc(.text+0x33): undefined reference to `ostream::operator<<(char const * : )' : myfirst.cc(.text+0x40): undefined reference to `cout' : myfirst.cc(.text+0x45): undefined reference to `ostream::operator<<(char const * : )'