public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
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 13:16:00 -0000	[thread overview]
Message-ID: <1196514982.25393.23.camel@camille.espersunited.com> (raw)
In-Reply-To: <8bc817ee0712010509y5be58b3bhee821c4888a31402@mail.gmail.com>


On Sat, 2007-12-01 at 07:09 -0600, Tom Browder wrote:
> On Dec 1, 2007 6:42 AM, Michael Sullivan <michael@espersunited.com> wrote:
> ...
> > > LIBS=`sdl-config --cflags --libs` -lSDL_image -lSDL_gfx -lSDL_ttf
> 
> Show the output from make initially so I can see the results of the LIBS line.
> 
> What is the 'reset' for in your make commands?
It clears the terminal and the terminal buffer so that I can see only
the current error output.
> 
> A more conventional way to structure the makefile for your situation is:
> 
> CXX=g++
> INC = -I/usr/include/SDL
> 
> all: battle
> 
> battle: battle.o character.o
> <tab>$(CXX) -o $@ battle.o character.o $(LIBS)
> 
> %.o : %.cpp
> <tab>$(CXX) $(CFLAGS) $< -o $@ $(INC)
> 
> 
> That way 'all' is the default target and you can just command 'make'.
> 
> Now, again, I suspect the location of the libraries is part of the
> problem.  Is the library set publicly available (and free)?
> 
> > Is it normal for only portions of make all to run at a time?
> 
> Yes, if it detects a target needing remaking.
> 
> -Tom
> 
> Tom Browder
> Niceville, Florida
> USA

Here's my Makefile now:

LIBS=`sdl-config --cflags --libs` -lSDL_image -lSDL_gfx -lSDL_ttf
INC = -I/usr/include/SDL

all: battle

battle: battle.o character.o 
	$(CXX) -o $@ battle.o character.o $(LIBS)

%.o : %.cpp 
	$(CXX) $(CFLAGS) $< -o $@ $(INC)

And here's the result of 'make':

michael@camille ourrpg $ make
g++ -W -Wall -pedantic battle.cpp -o battle.o -I/usr/include/SDL
battle.cpp: In member function 'SDL_Surface* battle::drawString(int,
int, char*)':
battle.cpp:72: warning: missing initializer for member
'SDL_Color::unused'
/tmp/ccETTf7v.o: In function `battle::loadImage(int, char*)':
battle.cpp:(.text+0x11): undefined reference to `IMG_Load'
battle.cpp:(.text+0x2d): undefined reference to `SDL_GetError'
battle.cpp:(.text+0x71): undefined reference to `SDL_MapRGB'
battle.cpp:(.text+0x9d): undefined reference to `SDL_SetColorKey'
/tmp/ccETTf7v.o: In function `battle::drawLines()':
battle.cpp:(.text+0x18d): undefined reference to `hlineColor'
battle.cpp:(.text+0x1bf): undefined reference to `vlineColor'
battle.cpp:(.text+0x1f1): undefined reference to `hlineColor'
battle.cpp:(.text+0x223): undefined reference to `vlineColor'
battle.cpp:(.text+0x255): undefined reference to `hlineColor'
battle.cpp:(.text+0x287): undefined reference to `hlineColor'
battle.cpp:(.text+0x2b9): undefined reference to `hlineColor'
battle.cpp:(.text+0x2eb): undefined reference to `hlineColor'
battle.cpp:(.text+0x31d): undefined reference to `vlineColor'
battle.cpp:(.text+0x34f): undefined reference to `SDL_UpdateRect'
/tmp/ccETTf7v.o: In function `battle::drawString(int, int, char*)':
battle.cpp:(.text+0x387): undefined reference to `TTF_RenderText_Solid'
battle.cpp:(.text+0x395): undefined reference to `SDL_GetError'
battle.cpp:(.text+0x420): undefined reference to `SDL_UpperBlit'
/tmp/ccETTf7v.o: In function `battle::drawScreen()':
battle.cpp:(.text+0x704): undefined reference to `SDL_UpperBlit'
battle.cpp:(.text+0x73c): undefined reference to `SDL_Flip'
/tmp/ccETTf7v.o: In function `battle::~battle()':
battle.cpp:(.text+0x760): undefined reference to `SDL_FreeSurface'
battle.cpp:(.text+0x778): undefined reference to `TTF_CloseFont'
battle.cpp:(.text+0x793): undefined reference to `SDL_FreeSurface'
battle.cpp:(.text+0x7a5): undefined reference to `SDL_FreeSurface'
/tmp/ccETTf7v.o: In function `battle::~battle()':
battle.cpp:(.text+0x892): undefined reference to `SDL_FreeSurface'
battle.cpp:(.text+0x8aa): undefined reference to `TTF_CloseFont'
battle.cpp:(.text+0x8c5): undefined reference to `SDL_FreeSurface'
battle.cpp:(.text+0x8d7): undefined reference to `SDL_FreeSurface'
/tmp/ccETTf7v.o: In function `battle::battle()':
battle.cpp:(.text+0x9e3): undefined reference to
`Character::Character()'
battle.cpp:(.text+0xa05): undefined reference to `SDL_Init'
battle.cpp:(.text+0xaa9): undefined reference to `SDL_GetError'
battle.cpp:(.text+0xac0): undefined reference to `SDL_Quit'
battle.cpp:(.text+0xaca): undefined reference to `TTF_Init'
battle.cpp:(.text+0xad9): undefined reference to `SDL_GetError'
battle.cpp:(.text+0xb0f): undefined reference to
`Character::Character(char*, long, long)'
battle.cpp:(.text+0xb35): undefined reference to
`Character::~Character()'
battle.cpp:(.text+0xb5b): undefined reference to
`Character::Character(char*, long, long)'
battle.cpp:(.text+0xb83): undefined reference to
`Character::~Character()'
battle.cpp:(.text+0xba9): undefined reference to
`Character::Character(char*, long, long)'
battle.cpp:(.text+0xbd1): undefined reference to
`Character::~Character()'
battle.cpp:(.text+0xbf4): undefined reference to
`Character::Character(char*, long, long)'
battle.cpp:(.text+0xc16): undefined reference to
`Character::~Character()'
battle.cpp:(.text+0xc2a): undefined reference to `TTF_OpenFont'
battle.cpp:(.text+0xc41): undefined reference to `SDL_GetError'
battle.cpp:(.text+0xc65): undefined reference to `SDL_WM_SetCaption'
battle.cpp:(.text+0xc89): undefined reference to `SDL_SetVideoMode'
battle.cpp:(.text+0xc9e): undefined reference to `SDL_GetError'
/tmp/ccETTf7v.o: In function `main':
battle.cpp:(.text+0xe81): undefined reference to `SDL_Delay'
/tmp/ccETTf7v.o: In function `battle::battle()':
battle.cpp:(.text+0xf19): undefined reference to
`Character::Character()'
battle.cpp:(.text+0xf3b): undefined reference to `SDL_Init'
battle.cpp:(.text+0xfdf): undefined reference to `SDL_GetError'
battle.cpp:(.text+0xff6): undefined reference to `SDL_Quit'
battle.cpp:(.text+0x1000): undefined reference to `TTF_Init'
battle.cpp:(.text+0x100f): undefined reference to `SDL_GetError'
battle.cpp:(.text+0x1045): undefined reference to
`Character::Character(char*, long, long)'
battle.cpp:(.text+0x106b): undefined reference to
`Character::~Character()'
battle.cpp:(.text+0x1091): undefined reference to
`Character::Character(char*, long, long)'
battle.cpp:(.text+0x10b9): undefined reference to
`Character::~Character()'
battle.cpp:(.text+0x10df): undefined reference to
`Character::Character(char*, long, long)'
battle.cpp:(.text+0x1107): undefined reference to
`Character::~Character()'
battle.cpp:(.text+0x112a): undefined reference to
`Character::Character(char*, long, long)'
battle.cpp:(.text+0x114c): undefined reference to
`Character::~Character()'
battle.cpp:(.text+0x1160): undefined reference to `TTF_OpenFont'
battle.cpp:(.text+0x1177): undefined reference to `SDL_GetError'
battle.cpp:(.text+0x119b): undefined reference to `SDL_WM_SetCaption'
battle.cpp:(.text+0x11bf): undefined reference to `SDL_SetVideoMode'
battle.cpp:(.text+0x11d4): undefined reference to `SDL_GetError'
collect2: ld returned 1 exit status
make: *** [battle.o] Error 1


  reply	other threads:[~2007-12-01 13:16 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 [this message]
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=1196514982.25393.23.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).