Undefined References

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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!




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux