Hello
I am trying to learn SDL from this tutorial ( http://lazyfooproductions.com/SDL_tu...on02/index.php ) but I am having some troubles compiling with make.
If i just use: "g++ -lSDL main.cpp -o play" the program works fine.
But if I instead use this makefile the program quits with a Segmentation fault
Code:
CXX = g++
LDFLAGS = lSDL
OUTPUT = play
sources = main.cpp
OBJS = ${sources:.cpp=.o}
${OUTPUT}:${OBJS}
${CXX} -${LDFLAGS} ${OBJS} -o ${OUTPUT}
If I edit my makefile to this:
Code:
CXX = g++
LDFLAGS = lSDL
OUTPUT = play
sources = main.cpp
OBJS = ${sources:.cpp=.o}
${OUTPUT}:${OBJS}
${CXX} -${LDFLAGS} ${sources} -o ${OUTPUT} #using sources instead of OBJS
the program runs with no problems. So I think it has something to do with the *.o file but I have no idea what.
Does anyone know why the program gives a seg-fault when it is compiled using *.o files?