On Fri, 2007-11-30 at 22:43 -0600, Tom Browder wrote: > On Nov 30, 2007 10:28 PM, Michael Sullivan <michael@xxxxxxxxxxxxxxxx> wrote: > > > > On Fri, 2007-11-30 at 22:01 -0600, Tom Browder wrote: > > > On Nov 30, 2007 7:26 PM, Michael Sullivan <michael@xxxxxxxxxxxxxxxx> 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: > > > ... > > > Without even looking in detail at the source I see that the following > > > line is a compile line and should not have anything but the source > > > being compiled: > > > > > > > battle.o: battle.cpp > > > > reset; $(CC) $(CFLAGS) -c battle.cpp character.o $(LIBS); rm *~ > > > > > > Try changing to: > > > > > > battle.o: battle.cpp > > > reset; $(CC) $(CFLAGS) -c battle.cpp; rm *~ > > > > > > and see what happens. > ... > > This is make battle after applying the change you suggested, I deleted > > *.o just to make sure the object files were cureent: > > > > 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: > > battle.o: battle.cpp > reset; $(CC) $(CFLAGS) -c battle.cpp character.o > -I/path/to/SDL.h; rm *~ > > > character.h:8: warning: 'class Character' has virtual functions but > > non-virtual destructor > > Just change line 11 of character.h to: > > virtual ~Character(); > > -Tom > > Tom Browder > Niceville, Florida > USA OK, Using the following 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/SDL.h; rm *~ all: battle.o character.o reset; $(CC) $(CFLAGS) battle.o character.o $(LIBS) -o battle; rm *~ When I try to make battle, I get this: cc1plus: error: /usr/include/SDL/SDL.h: not a directory g++ battle.o -o battle g++: battle.o: No such file or directory g++: no input files make: *** [battle] Error 1 No battle.o . When I try it without the SDL.h at the end of the -I option, I get this: battle.cpp: In member function 'SDL_Surface* battle::drawString(int, int, char*)': battle.cpp:72: warning: missing initializer for member 'SDL_Color::unused' g++ battle.o -o battle battle.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' battle.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' battle.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' battle.o: In function `battle::drawScreen()': battle.cpp:(.text+0x704): undefined reference to `SDL_UpperBlit' battle.cpp:(.text+0x73c): undefined reference to `SDL_Flip' battle.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' battle.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' battle.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' battle.o: In function `main': battle.cpp:(.text+0xe81): undefined reference to `SDL_Delay' battle.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] Error 1 And, just to avoid confusion, here's my Makefile in it's current version: michael@camille ourrpg $ cat 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 *~