This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Undefined References
On Sat, 2007-12-01 at 09:44 -0600, Tom Browder wrote:
> On Dec 1, 2007 9:42 AM, Tom Browder <tom.browder@gmail.com> wrote:
> ...
> > define the virtual function:
> >
> > virtual void setCurrentSprite(int){} // not '{}' and not ';'
>
> That should have been:
>
> virtual void setCurrentSprite(int){} // note '{}' and not ';'
>
> -Tom
Is this right?
michael@camille ourrpg $ grep virtual character.h
virtual ~Character() {}
virtual void setCurrentSprite(int) {}
because when I make, I still get errors...
michael@camille ourrpg $ make clean
rm *.o *~ core* battle
rm: cannot remove `core*': No such file or directory
rm: cannot remove `battle': No such file or directory
make: [clean] Error 1 (ignored)
michael@camille ourrpg $ make
g++ -W -Wall -pedantic `sdl-config --cflags` -c battle.cpp
battle.cpp: In member function 'SDL_Surface* battle::drawString(int,
int, char*)':
battle.cpp:72: warning: missing initializer for member
'SDL_Color::unused'
g++ -W -Wall -pedantic `sdl-config --cflags` -c character.cpp
g++ -o battle battle.o character.o `sdl-config --libs` -lSDL_image
-lSDL_gfx -lSDL_ttf
battle.o: In function `battle::battle()':
battle.cpp:(.text+0x9e3): undefined reference to
`Character::Character()'
battle.o: In function `battle::battle()':
battle.cpp:(.text+0xf1b): undefined reference to
`Character::Character()'
collect2: ld returned 1 exit status
make: *** [battle] Error 1