I’m sorry to ask this here, but I’ve tried a few other lists, and
they’ve given me a few suggestions (which didn’t work), so I thought I’d
try here. I suspect this has something to do with my Makefile. This is
the first project I’ve done when I’ve attempted to use a Makefile. My
full code is too long to politely past into an email, but I’ve posted it
at http://www.espersunited.com/~michael/needhelp.txt
Here’s the 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 -I/usr/include/SDL/; rm *~
all: battle.o character.o
reset; $(CC) $(CFLAGS) battle.o character.o $(LIBS) -o battle; rm *~
character.o and battle.o are created, but when I try to make all, I get
the following errors:
battle.o: In function battle::battle()': battle.cpp:(.text+0x9e3): undefined reference to
Character::Character()'
battle.cpp:(.text+0xb35): undefined reference to
Character::~Character()' battle.cpp:(.text+0xb83): undefined reference to
Character::~Character()'
battle.cpp:(.text+0xbd1): undefined reference to
Character::~Character()' battle.cpp:(.text+0xc16): undefined reference to
Character::~Character()'
battle.o: In function battle::battle()': battle.cpp:(.text+0xf19): undefined reference to
Character::Character()'
battle.cpp:(.text+0x106b): undefined reference to
Character::~Character()' battle.cpp:(.text+0x10b9): undefined reference to
Character::~Character()'
battle.cpp:(.text+0x1107): undefined reference to
Character::~Character()' battle.cpp:(.text+0x114c): undefined reference to
Character::~Character()'
character.o: In function Character::Character(char*, long, long)': character.cpp:(.text+0xdb): undefined reference to
vtable for
Character’
character.o: In function Character::Character(char*, long, long)': character.cpp:(.text+0x12d): undefined reference to
vtable for
Character’
collect2: ld returned 1 exit status
I don’t understand why. This is my first SDL project, and my first
multifile C/C++ project, so I’m kinda out of my element here. Thank you
in advance for your help…
-Michael Sullivan-