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 12:43:00 -0000 [thread overview]
Message-ID: <1196512977.25400.20.camel@camille.espersunited.com> (raw)
In-Reply-To: <8bc817ee0712010422g139eefcfxea13bdec38b79b42@mail.gmail.com>
On Sat, 2007-12-01 at 06:22 -0600, Tom Browder wrote:
> On Dec 1, 2007 5:31 AM, Michael Sullivan <michael@espersunited.com> wrote:
> > On Fri, 2007-11-30 at 22:43 -0600, Tom Browder wrote:
> > > On Nov 30, 2007 10:28 PM, Michael Sullivan <michael@espersunited.com> wrote:
> > > >
> > > > On Fri, 2007-11-30 at 22:01 -0600, Tom Browder wrote:
> > > > > On Nov 30, 2007 7:26 PM, Michael Sullivan <michael@espersunited.com> wrote:
> > > > > > 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:
> ...
> > > > In file included from battle.cpp:4:
> > > > /usr/local/include/SDL/SDL_gfxPrimitives.h:17:17: error: SDL.h: No such
> > > > file or directory
> > >
> > > You may need the -I (hyphen uppercase i) option to tell gcc where to
> > > find SDL.h. For instance:
>
> Look carefully at the gcc manual and the options to g++, the '-I'
> option, which may be used multiple times, gives a path to search for
> include files.
>
> Now, I can't help the warning at the moment, but the show stoppers are
> the undefined references which are probably defined in the missing
> libraries you asked for on the line:
>
> LIBS=`sdl-config --cflags --libs` -lSDL_image -lSDL_gfx -lSDL_ttf
>
> You probably need to add one or more '-L' options which you use to
> tell gcc where to find libraries (for details, see the gcc manual).
>
> -Tom
>
> Tom Browder
> Niceville, Florida
> USA
Actually now, and I find this very strange; I rm *.o and run 'make all'
and it gives me this output:
battle.cpp: In member function 'SDL_Surface* battle::drawString(int,
int, char*)':
battle.cpp:72: warning: missing initializer for member
'SDL_Color::unused'
rm: cannot remove `*~': No such file or directory
make: *** [battle.o] Error 1
but battle.o is created. character.o is not. The second time I run
make all, both character.o and battle.o exist. The third time I run
make all, it gives me 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
rm: cannot remove `*~': No such file or directory
make: *** [all] Error 1
Once again, here is my current 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 *~
Is it normal for only portions of make all to run at a time?
next prev parent reply other threads:[~2007-12-01 12:43 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 [this message]
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
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=1196512977.25400.20.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).