public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Undefined References
@ 2007-12-01  1:26 Michael Sullivan
  2007-12-01  4:01 ` Tom Browder
  0 siblings, 1 reply; 30+ messages in thread
From: Michael Sullivan @ 2007-12-01  1:26 UTC (permalink / raw)
  To: gcc-help

I'm having trouble building my project.  This is my first project I've
worked on that uses make, so I'm having a lot of problems with it.
Here's my Makefile:

CC=g++
CFLAGS=-W -Wall -pedantic
LIBS=`sdl-config --cflags --libs` -lSDL_image -lSDL_gfx -lSDL_ttf

character.o: character.cpp
	reset; $(CC) $(CFLAGS) -c character.cpp;rm *~

battle.o: battle.cpp
	reset; $(CC) $(CFLAGS) -c battle.cpp character.o $(LIBS); rm *~

all: battle.o character.o
	reset; $(CC) $(CFLAGS) battle.o character.o $(LIBS) -o battle; rm *~

I've successfully compiled character.o and battle.o, but when I try to
make all, I get a bunch of undefined references errors:

battle.o: In function `battle::battle()':
battle.cpp:(.text+0x9ab): undefined reference to
`Character::Character()'
battle.o: In function `battle::battle()':
battle.cpp:(.text+0xecf): undefined reference to
`Character::Character()'
character.o: In function `Character::~Character()':
character.cpp:(.text+0xdb): undefined reference to `vtable for
Character'
character.o: In function `Character::~Character()':
character.cpp:(.text+0xfb): undefined reference to `vtable for
Character'
character.o: In function `Character::Character(char*, long, long)':
character.cpp:(.text+0x11b): undefined reference to `vtable for
Character'
character.o: In function `Character::Character(char*, long, long)':
character.cpp:(.text+0x16d): undefined reference to `vtable for
Character'
collect2: ld returned 1 exit status
rm: cannot remove `*~': No such file or directory
make: *** [all] Error 1

My source code is too long to paste into an email (I should say that it
would be impolite to paste all of it into this email), but the full
source code, Makefile, and the errors are at
http://www.espersunited.com/~michael/needhelp.txt .  Please help!



^ permalink raw reply	[flat|nested] 30+ messages in thread
* Re: Undefined References
@ 2007-12-01 15:14 J.C. Pizarro
  2007-12-01 15:30 ` Tom Browder
  0 siblings, 1 reply; 30+ messages in thread
From: J.C. Pizarro @ 2007-12-01 15:14 UTC (permalink / raw)
  To: Tom Browder, gcc-help

On 2007/12/01, "Tom Browder" <tom.browder@gmail.com> wrote:
> On Dec 1, 2007 8:28 AM, Michael Sullivan <michael@espersunited.com> wrote:
> ...
> michael@camille ourrpg $ rm *.o
>
> A target line at the end of Makefile will ease that:
>
> clean:
> <tab>-rm *.o battle *~
>
> Then you can do:
>
>   make clean
>
> > g++ -W -Wall -pedantic -c battle.cpp -o battle.o -I/usr/include/SDL
> > battle.cpp: In member function 'SDL_Surface* battle::drawString(int,
> > int, char*)':
> > battle.cpp:72: warning: missing initializer for member
> > 'SDL_Color::unused'
>
> A C++ error.
>
> > g++ -W -Wall -pedantic -c character.cpp -o character.o
> > -I/usr/include/SDL
> > g++ -o battle battle.o character.o `sdl-config --cflags --libs`
> > -lSDL_image -lSDL_gfx -lSDL_ttf
> > battle.o: In function `battle::battle()':
> > battle.cpp:(.text+0x9e3): undefined reference to
> > `Character::Character()'
> ...
>
> I'm investigating.
>
> -Tom
>
> Tom Browder
> Niceville, Florida
> USA

Why doesn't it publish the parts of source code character.cpp and
battle.cpp related with their uses and definitions?

Is it well written the Character() constructor?

Are there headers?

   J.C.Pizarro

^ permalink raw reply	[flat|nested] 30+ messages in thread
* RE: undefined references
@ 2004-04-27 12:21 Lev Assinovsky
  0 siblings, 0 replies; 30+ messages in thread
From: Lev Assinovsky @ 2004-04-27 12:21 UTC (permalink / raw)
  To: gnuml, gcc-help

Hi Martin!
Could you please show your makefile and sample 
of error messages.

----
Lev Assinovsky
Aelita Software Corporation 
(now is a part of Quest Software)
O&S InTrust Framework Division, Team Leader
ICQ# 165072909


> -----Original Message-----
> From: gnuml [mailto:gnuml@bootweb.nl]
> Sent: Tuesday, April 27, 2004 3:43 PM
> To: gcc-help@gcc.gnu.org
> Subject: undefined references
> 
> 
> Hi,
> 
> I am trying to compile some C++ code and link it to a couple of C++
> libraries (Informix c++ libs). However, I get 'undefined 
> references' for every
> object from the libraries I use. The code compiles fine though.
> Could anybody give me some suggestions on how to test the 
> libraries/what
> to be aware of when linking/what might cause the problem?
> I'm using gcc 3.3.1 and all librarie are in place & specified in the
> makefile.
> Thanks alot!
> 
> Martin
> 

^ permalink raw reply	[flat|nested] 30+ messages in thread
* undefined references
@ 2004-04-27 11:43 gnuml
  2004-04-27 12:16 ` Eljay Love-Jensen
  0 siblings, 1 reply; 30+ messages in thread
From: gnuml @ 2004-04-27 11:43 UTC (permalink / raw)
  To: gcc-help

Hi,

I am trying to compile some C++ code and link it to a couple of C++
libraries (Informix c++ libs). However, I get 'undefined references' for every
object from the libraries I use. The code compiles fine though.
Could anybody give me some suggestions on how to test the libraries/what
to be aware of when linking/what might cause the problem?
I'm using gcc 3.3.1 and all librarie are in place & specified in the
makefile.
Thanks alot!

Martin

^ permalink raw reply	[flat|nested] 30+ messages in thread
[parent not found: <B56E6BDB.43%jokada@oceanit.com>]

end of thread, other threads:[~2007-12-02 11:42 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-12-01  1:26 Undefined References Michael Sullivan
2007-12-01  4:01 ` Tom Browder
2007-12-01  4:28   ` Michael Sullivan
2007-12-01  4:43     ` Tom Browder
2007-12-01 11:32       ` Michael Sullivan
2007-12-01 12:22         ` Tom Browder
2007-12-01 12:43           ` Michael Sullivan
2007-12-01 13:09             ` Tom Browder
2007-12-01 13:16               ` Michael Sullivan
2007-12-01 13:23                 ` Brian Dessent
2007-12-01 13:27                   ` Michael Sullivan
2007-12-01 14:22                     ` Tom Browder
2007-12-01 14:28                       ` Michael Sullivan
2007-12-01 14:45                         ` Tom Browder
2007-12-01 15:27                           ` Tom Browder
2007-12-01 15:34                             ` Michael Sullivan
2007-12-01 15:43                               ` Tom Browder
2007-12-01 15:44                                 ` Tom Browder
2007-12-01 15:49                                   ` Michael Sullivan
2007-12-01 16:01                                     ` Tom Browder
2007-12-02  2:59                                       ` Tom Browder
2007-12-02 11:42                                         ` Undefined References [SOLVED] Michael Sullivan
2007-12-01 17:45                                 ` Undefined References Ted Byers
2007-12-01 13:29                   ` Tom Browder
  -- strict thread matches above, loose matches on Subject: below --
2007-12-01 15:14 J.C. Pizarro
2007-12-01 15:30 ` Tom Browder
2004-04-27 12:21 undefined references Lev Assinovsky
2004-04-27 11:43 gnuml
2004-04-27 12:16 ` Eljay Love-Jensen
     [not found] <B56E6BDB.43%jokada@oceanit.com>
2000-06-15 14:35 ` llewelly

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).