[SDL] Makefile

Micah Lee micah at mindgrasp.com
Tue Jan 7 05:43:01 PST 2003

I'm playing around with linux for the first time and I'm trying to
create a Makefile for a very simple SDL program that does nothing but
initialize graphics and does the event loop until escape is pressed. It
has one file, main.cpp.  This is what my Makefile looks like:

test: main.cpp
	gcc -c main.cpp
	gcc main.o -lSDL -o test

When I run make on this, it shows me all kinds of stuff, starting with

[micah at mandrake9 test]$ make
gcc -c main.cpp
gcc main.o -lSDL -o test
main.o(.eh_frame+0x11): undefined reference to `__gxx_personality_v0'
/usr//bin/../lib/gcc-lib/i586-mandrake-linux-gnu/3.2/../../../libSDL.a(SDL_x11video.lo): In function `X11_Available':
SDL_x11video.lo(.text+0x1d): undefined reference to `XOpenDisplay'
SDL_x11video.lo(.text+0x2f): undefined reference to `XCloseDisplay'
/usr//bin/../lib/gcc-lib/i586-mandrake-linux-gnu/3.2/../../../libSDL.a(SDL_x11video.lo): In function `create_aux_windows':
SDL_x11video.lo(.text+0x453): undefined reference to `XDestroyWindow'
SDL_x11video.lo(.text+0x4ff): undefined reference to `XCreateWindow'

and the errors just keep coming.  I have a feeling this is either a
messed up installation of SDL-devel (which I don't think it is, because
I used the RPM), or my Makefile is somehow messed up.  Can anyone help? 

- Micah

More information about the SDL mailing list