www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/09/23/14:36:44

Message-Id: <199709231825.NAA23245@labrats.com>
Date: Tue, 23 Sep 1997 13:32:25 -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

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