Sdl lib problems

Hi. I am a wanna be programmer(so please don’t expect too much of me).
Anyways I am trying to compile a little bit of code I wrote and

gcc -D_RENTRANT -g -O2 -lSDL -lpthread -o lsim main.o console.o
main.o: In function main': /home/mike/projects/lsim/main.c:14: undefined reference toSDL_Init’

there are more of the same errors. Anyways could you tell me what I am
doing wrong because I messed around for an hour or two and I am still

Try this:
gcc -c main.c console.c -g -O2 -D_REENTRANT
gcc -o lsim main.o console.o -g -O2 -lSDL -lpthread

You might also copy the SDL/test/GNUmake file to your directory and
create a Makefile that looks something like:

TARGET = lsim
include GNUmake
$(TARGET): main.o console.o

And then you can type ‘make’

Good luck! :slight_smile:

See ya!
-Sam Lantinga (slouken at–
Author of Simple DirectMedia Layer -