www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/09/24/11:33:11

Message-Id: <199709241521.KAA26771@labrats.com>
Date: Wed, 24 Sep 1997 10:28:55 -0500
From: "Geoff Weber" <gweber AT tr DOT labrats DOT com>
To: jackgibs AT sprynet DOT com
Cc: djgpp AT delorie DOT com
Subject: RE: "Why 'undefined reference' in link?"
Mime-Version: 1.0

I was asked to supply more details on the problem below, so
here they are:

I am not using RHIDE at this time, I am using an editor called
"Multi-Edit".  To be honest, I didn't even know what RHIDE was
until I was asked if I used it or not!  I did check it out though, and
I may start using it more...but I digress!

I have used the following command lines in an attempt to compile
just one of the modules with a simple "cout" main (it also declares
and uses an instance of the class I am compiling, because I read
in one of the archived mail messages that the compiler might want
an instance declared):

	gcc -Wall -o mime64.exe mime64.cpp	(didn't expect this to work)
	gcc -Wall -o mime64.exe mime64.cpp -lgpp	(ditto)
	gcc -Wall -o mime64.exe mime64.cpp -lgpp -lstdcxx	(SHOULD work)
	gxx -Wall -o mime64.exe mime64.cpp	(all these should work)
	gxx -Wall -o mime64.exe mime64.cpp -lgpp
	gxx -Wall -o mime64.exe mime64.cpp -lgpp -lstdcxx

         /  gcc -Wall -c mime64.cpp
       <   gcc -Wall -o mime64.exe mime64.o	(tried the libraries above also)
         \  gxx -Wall -o mime64.exe mime64.o (tried the libraries above also)

Here is the output of the verbose build attempt from RHIDE (couldn't capture the
output otherwise - scrolled offscreen)....

 Compiling: mime64.cc
 Reading specs from c:/djgpp/lib\specs
 gcc version 2.7.2.1
  c:/djgpp/bin\cpp.exe -lang-c++ -v -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -D__GNUC_MINOR__=7 -Dunix -Di386 -DGO32 -DMSDOS -DDJGPP=2 -DDJGPP_MINOR=1 -D__unix__ -D__i386__ -D__GO32__ -D__MSDOS__ -D__DJGPP__=2 -D__DJGPP_MINOR__=1 -D__unix -D__i386
 GNU CPP version 2.7.2.1 (80386, BSD syntax)
 #include "..." search starts here:
 #include <...> search starts here:
  c:/djgpp/lang/cxx
  c:/djgpp/include
  c:/djgpp/contrib/grx20/include
  /usr/local/lib/g++-include
  /usr/local/include
  /usr/local/go32/include
  /usr/local/lib/gcc-lib/go32/2.7.2.1/include
  /usr/include
 End of search list.
  c:/djgpp/bin\cc1plus.exe c:/djgpp/tmp/RHaaaaaa\ccbaaaaa -quiet -dumpbase mime64.cc -g -Wall -version -o c:/djgpp/tmp/RHaaaaaa\cccaaaaa
 GNU C++ version 2.7.2.1 (80386, BSD syntax) compiled by GNU C version 2.7.2.1
  c:/djgpp/bin\as.exe -o mime64.o c:/djgpp/tmp/RHaaaaaa\cccaaaaa
 no errors
 Creating: mime64.exe
 Error: mime64.o: In function `mime64::mime64(void)':
 mime64.cc(12) Error: undefined reference to `mime64::encode_string'
 mime64.cc(14) Error: undefined reference to `mime64::encode_string'
 mime64.cc(16) Error: undefined reference to `mime64::encode_string'
 Error: mime64.cc(.text+0xda): undefined reference to `mime64::encode'
 mime64.cc(17) Error: undefined reference to `mime64::decode'
 Error: mime64.cc(.text+0x10d): undefined reference to `mime64::encode_string'
 Error: mime64.o: In function `mime64::Encode64(basic_string<char, string_char_traits<char> > &)':
 mime64.cc(45) Error: undefined reference to `mime64::encode'
 mime64.cc(51) Error: undefined reference to `mime64::encode'
 mime64.cc(54) Error: undefined reference to `mime64::encode'
 mime64.cc(58) Error: undefined reference to `mime64::encode'
 mime64.cc(59) Error: undefined reference to `mime64::encode'
 Error: mime64.o: In function `mime64::Decode64(basic_string<char, string_char_traits<char> > &)':
 mime64.cc(94) Error: undefined reference to `mime64::decode'
 Error: mime64.cc(.text+0x505): undefined reference to `mime64::decode'
 Error: mime64.cc(.text+0x534): undefined reference to `mime64::decode'
 Error: mime64.cc(.text+0x563): undefined reference to `mime64::decode'
 mime64.cc(109) Error: undefined reference to `mime64::decode'
 Error: mime64.o(.text+0x61f):mime64.cc: more undefined references to `mime64::decode' follow
 There were some errors


If anyone needs more information, please let me know!  Thanks for any help
you can offer - I'm just puzzled!!

I have read the FAQ, and tried also looked at the mail-archive on the delorie.com
site.  The only problems I saw that were similar to mine (env variable set correctly,
fresh 2.0+ install) did not have answers to their problems posted, which is why
I sent out this cry for help!

Thanks again!!!

	Geoff
	gweber AT labrats DOT com

>Jack,
>
>I realize it has been quite a while since you posted your note to the
>DJGPP mail-archive about problems you were having linking "hex.cc".
>However, I have run into the same exact problem you seem to have
>had, and was wondering if you ever found out how to get around this
>problem... more details follow.
>
>I downloaded and installed the DJGPP v2.0 distribution as per instructions
>(fresh install).  I also read the FAQ and any other info I could find
>the last 2 days on this problem, but still don't know what causes it.
>Basically, I am using some of the STL components (vectors, maps, etc),
>as well as the "string" class ( basic_string<char, char_traits> or whatever ),
>and when I compile the modules, each compiles without any warnings or
>errors, but when I try to link them together, I get a slew of "undefined
>reference" errors.  Even when I try to compile each one seperately, with
>a simple stub main() function, I still get the same "undefined reference"
>errors - even with functions and variables completely defined and available
>inside that same module!!
>
>I have tried using both gcc and gxx, as per the FAQ, and also tried
>compiling with the -c option to get the *.o files, then linking as a
>seperate step.  I have also tried to explicitly including the g++ and
>stdcxx libraries via the -lgpp and -lstdcxx switches.
>
>Can someone please tell me what I am doing wrong?
>
>Thanks!!!
>
>Geoff Weber
>gweber AT labrats DOT com
>
>
>
>On April 19th, you posted:
>
>>I am new to DJGPP.  I have a problem and would appreciate any help.  It's
>>probably something simple I am overlooking.
>>
>>When using RHIDE 1.2, and trying to Make using the following files in
>>a project, I get the following error messages during link:
>>
>>Creating: hexgrid.exe
>>Error: hex.o: In function `HEX::SetSize(int)':
>>hex.cc(15) Error: undefined reference to `HEX::size'
>>Error: hex.o: In function `HEX::GetSize(void)':
>>hex.cc(20) Error: undefined reference to `HEX::size'
>>Error: hex.o: In function `HEX::SetOffset(XY, int)':
>>hex.cc(25) Error: undefined reference to `HEX::offset'
>>Error: hex.cc(.text+0x27a): undefined reference to `HEX::offset'
>>Error: hex.o: In function `HEX::GetOffset(int)':
>>hex.cc(30) Error: undefined reference to `HEX::offset'
>>Error: hex.cc(.text+0x2a5): undefined reference to `HEX::offset'
>>Error: hex.o: In function `HEX::InitHex(int)':
>>hex.cc(39) Error: undefined reference to `HEX::size'
>>hex.cc(41) Error: undefined reference to `HEX::offset'
>>Error: hex.cc(.text+0x33b): undefined reference to `HEX::offset'
>>hex.cc(42) Error: undefined reference to `HEX::offset'
>>Error: hex.cc(.text+0x35e): undefined reference to `HEX::offset'
>>Error: hex.cc(.text+0x385): undefined reference to `HEX::offset'
>>Error: hex.o(.text+0x38e):hex.cc: more undefined references to
>`>HEX::offset'
>>There were some errors
>>
>>I tried compiling and linking the same files using Turbo C++ and there were
>>no errors.
>
>

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019