From: Michael Sullivan <michael@espersunited.com>
To: Tom Browder <tom.browder@gmail.com>
Cc: gcc-help@gcc.gnu.org
Subject: Re: Undefined References
Date: Sat, 01 Dec 2007 15:34:00 -0000 [thread overview]
Message-ID: <1196523242.9670.2.camel@camille.espersunited.com> (raw)
In-Reply-To: <8bc817ee0712010726v7fbba8b0kfa548a547128661d@mail.gmail.com>
On Sat, 2007-12-01 at 09:26 -0600, Tom Browder wrote:
> You're getting the errors about vtable... because you have an
> undefined virtual function declared in character.h.
>
> Getting rid of the virtual attribute eliminates those errors and
> allows a successful build (and you can eliminate the virtual
> destructor).
>
The virtual destructor is there because g++ was giving me a warning
about setCurrentSprite(int), which will be implemented in classes Ally
and Enemy - both descended from Character. I've commented out the
virtual destructor in character.h and used your Makefile with the
following output:
michael@camille ourrpg $ make
g++ -W -Wall -pedantic `sdl-config --cflags` -c battle.cpp
character.h:8: warning: 'class Character' has virtual functions but
non-virtual destructor
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
character.h:8: warning: 'class Character' has virtual functions but
non-virtual destructor
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+0x84b): undefined reference to
`Character::Character()'
battle.o: In function `battle::battle()':
battle.cpp:(.text+0xc37): 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
make: *** [battle] Error 1
> Then you can concentrate on other problems in the overall program, if any.
>
> I've attached a little cleaner Makefile for your consideration.
>
> -Tom
next prev parent reply other threads:[~2007-12-01 15:34 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-12-01 1:26 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 [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1196523242.9670.2.camel@camille.espersunited.com \
--to=michael@espersunited.com \
--cc=gcc-help@gcc.gnu.org \
--cc=tom.browder@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).