From: brian j tang Organization: University of Wisconsin To: "Wing J. Flanagan" <76451 DOT 2647 AT compuserve DOT com>, djgpp AT sun DOT soe DOT clarkson DOT edu Date: Fri, 24 Mar 1995 18:24:47 CST Subject: Re: Problems compiling C++ programs Reply-To: brian DOT tang AT plantpath DOT wisc DOT edu > > c:\>gcc -v string4.cpp -o string You need to explicitly link the C++ iostream library by doing: gcc -v -liostr string.cpp -o string > Reading specs from c:/djgpp/lib\specs > gcc version 2.6.3 > c:/djgpp/bin\cpp.exe -lang-c++ -v -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus > -D__GNUC_MINOR__=6 -Dunix -Di386 -DGO32 -DMSDOS -D__unix__ -D__i386__ -D__GO32__ > -D__MSDOS__ -D__unix -D__i386 -D__GO32 -D__MSDOS string4.cpp > c:/djgpp/tmp\cc000056 > GNU CPP version 2.6.3 (80386, BSD syntax) > #include "..." search starts here: > #include <...> search starts here: > c:/djgpp/cplusinc > c:/djgpp/include > /usr/local/lib/g++-include > /usr/local/include > /usr/local/go32/include > /usr/local/lib/gcc-lib/go32/2.6.1/include > /usr/include > End of search list. > c:/djgpp/bin\cc1plus.exe c:/djgpp/tmp\cc000056 -quiet -dumpbase string4.cc > -version -o c:/djgpp/tmp\cca00056 > GNU C++ version 2.6.3 (80386, BSD syntax) compiled by GNU C version 2.6.3. > c:/djgpp/bin\as.exe -o c:/djgpp/tmp\cc00056 c:/djgpp/tmp\cca00056 > c:/djgpp/bin\ld.exe -o string c:/djgpp/lib\crt0.o -Lc:/djgpp/lib > c:/djgpp/tmp\ccb00056 -lgcc -lc -lgcc > > /* Then there's a whole slew of lines which are nearly identical*/ > > string4.cc(.text+0x174): undefined reference to 'cout' > string4.cc(.text+0x179): undefined reference to 'ostream::operator<<(char const > *)' > string4.cc(.text+0x189): undefined reference to 'cin' > string4.cc(.text+0x18e): undefined reference to 'istream::getline(char *, int, > char)' > ... > /* Etc. For several screens. It gives you the idea; forgive me if I don't type > every single line! That's how it ends. No STRING file written. Nothing to run. > Nothing to debug.*/ homepage XXX XXX XXXXX XXXXX XXX XXX Brian J. Tang Programmer & Lan Admin & Student U of Wisconsin XXXX XXXX XX XX XX XX bjt AT plantpath DOT wisc DOT edu XX XX XX XX btang AT cs DOT wisc DOT edu XX XX tangb AT cae DOT wisc DOT edu XXX XXX tXXXXXXXXXXc