Xref: news-dnh.mv.net comp.os.msdos.djgpp:3383 Path: news-dnh.mv.net!mv!news.sprintlink.net!europa.chnt.gtegsc.com!paladin.american.edu!gatech!newsfeed.internetmci.com!in2.uu.net!usc!math.ohio-state.edu!jussieu.fr!univ-lyon1.fr!in2p3.fr!swidir.switch.ch!scsing.switch.ch!rzunews.unizh.ch!alex From: alex AT zool DOT unizh DOT ch (Alex Schroeder) Newsgroups: comp.os.msdos.djgpp Subject: Using the GNU C++ library & linkage errors Date: 22 Nov 1995 08:37:28 GMT Organization: University of Zurich, Switzerland Lines: 150 Nntp-Posting-Host: rzurs10.unizh.ch Keywords: linking, library, c++ To: djgpp AT sun DOT soe DOT clarkson DOT edu Dj-Gateway: from newsgroup comp.os.msdos.djgpp My Problem is, that I cannot compile any code which uses the libgpp.a library (ie. the String class and all the other ones). I tried uncountable ways of linking the different libraries, but to no avail. I can compile to object *.o files, but I cannot link them. I have read the FAQ 1.02 and it doesn't help (section 8.10 and 8.11). I have listet here all the information which could possibly be relevant in order to solve the problem. I would appreciate any help at all. Perhaps my specs file is ruined? I am running DOS 6.00 on a 486/33DX, use GCC 2.6.3 maintenance 4. I can compile C code without any problems at all. Alex. Test program called TEST.CPP: ------------------------------------------------------------------------ #include <_string.h> main () { String x; } ------------------------------------------------------------------------ MAKEFILE (stripped a bit): ------------------------------------------------------------------------ SHELL = $(COMSPEC) /c ..PHONY : clean test1: test.cpp gcc -v test.cpp -o test1.cof -lgpp -lgpl -lm -lpc > test1.rep test2: test.cpp gcc -v test.cpp -o test2.cof -lgpp -lgpl > test2.rep test3: test.cpp gcc -v -O test.cpp -o test3.cof -lgpp -lgpl -lm -lpc > test3.rep clean: del *.rep del *.cof del *.o del *.bak ------------------------------------------------------------------------ A Sample Result (test1.rep looks just like test2 and test3): ------------------------------------------------------------------------ Reading specs from c:/util/gcc/lib\specs gcc version 2.6.3 c:/util/gcc/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 test.cpp c:/TEMP\cc000119 GNU CPP version 2.6.3 (80386, BSD syntax) #include "..." search starts here: #include <...> search starts here: c:/util/gcc/cplusinc c:/util/gcc/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:/util/gcc/bin\cc1plus.exe c:/TEMP\cc000119 -quiet -dumpbase test.cc -version -o c:/TEMP\cca00119 GNU C++ version 2.6.3 (80386, BSD syntax) compiled by GNU C version 2.6.3. c:/util/gcc/bin\as.exe -o c:/TEMP\ccb00119 c:/TEMP\cca00119 c:/util/gcc/bin\ld.exe -o test1.cof c:/util/gcc/lib\crt0.o -Lc:/util/gcc/lib c:/TEMP\ccb00119 -lgpp -lgpl -lm -lpc -lgcc -lc -lgcc String.cc(.text+0x15be): undefined reference to `ostream::operator<<(char const *)' String.cc(.text+0x1967): undefined reference to `lib_error_handler' String.cc(.text+0x1a25): undefined reference to `lib_error_handler' String.cc(.text+0x1ae1): undefined reference to `lib_error_handler' String.cc(.text+0x1b3b): undefined reference to `lib_error_handler' String.cc(.text+0x1c45): undefined reference to `lib_error_handler' String.cc(.text+0x1d75): more undefined references to `lib_error_handler' follow String.cc(.text+0x405e): undefined reference to `ostream::flush(void)' String.cc(.text+0x4072): undefined reference to `istream::_skip_ws(void)' String.cc(.text+0x4096): undefined reference to `ws(istream &)' String.cc(.text+0x40f1): undefined reference to `__uflow' String.cc(.text+0x41a8): undefined reference to `ostream::flush(void)' String.cc(.text+0x41bc): undefined reference to `istream::_skip_ws(void)' String.cc(.text+0x4206): undefined reference to `__uflow' String.cc(.text+0x42cf): undefined reference to `__overflow' _Regex.cc(.text+0x10e): undefined reference to `lib_error_handler' _Regex.cc(.text+0x254): undefined reference to `lib_error_handler' ------------------------------------------------------------------------ djgpp.env: ------------------------------------------------------------------------ DJDIR=%:/>DJGPP% +USER=dosuser +TMPDIR=%DJDIR%/tmp +GO32TMP=%DJDIR%/tmp [cpp] CPLUS_INCLUDE_PATH=%/>;CPLUS_INCLUDE_PATH%%DJDIR%/cplusinc;%DJDIR%/include C_INCLUDE_PATH=%/>;C_INCLUDE_PATH%%DJDIR%/include [gcc] COMPILER_PATH=%/>;COMPILER_PATH%%DJDIR%/bin LIBRARY_PATH=%/>;LIBRARY_PATH%%DJDIR%/lib [info] INFOPATH=%/>;INFOPATH%%DJDIR%/docs;%DJDIR%/docs/djgpp;%DJDIR%/docs/texinfo ------------------------------------------------------------------------ My real environment (cut out a few irrelevant things): ------------------------------------------------------------------------ CONFIG=DOS_GCC COMSPEC=C:\DOS\COMMAND.COM TEMP=C:\TEMP PATH=C:\DOS;C:\UTIL\DISK;C:\UTIL\ARC;C:\UTIL\GCC\BIN BLASTER=A220 I5 D1 T1 TZ=MET-1DST PGPPATH=c:\util\pgp DJGPP=c:/util/gcc/djgpp.env TMPDIR=c:/TEMP GO32TMP=c:/TEMP GO32=2r1 ansi driver c:/util/gcc/drivers/tseng4k.grd gw 1024 gh 768 ------------------------------------------------------------------------ -- Grofzg! Mofzg! NagaNnaga! NnnaAARGHGAA! Agha! Naganahhagga! PGP public key available on request from alex AT zool DOT unizh DOT ch