Dear List,
I?ve run in trouble to add SDL support in my own programs. I?ve wrote a
very simple test program and got the following error messages:
gcc -o grw_test grw_main.o
grw_main.o: In function main': grw_main.o(.text+0xc): undefined reference to
SDL_Init’
grw_main.o(.text+0x1d): undefined reference to SDL_GetError' grw_main.o(.text+0x45): undefined reference to
SDL_Quit’
grw_main.o(.text+0x63): undefined reference to SDL_SetVideoMode' grw_main.o(.text+0x79): undefined reference to
SDL_GetError’
grw_main.o(.text+0xa8): undefined reference to SDL_EventState' grw_main.o(.text+0xb8): undefined reference to
SDL_WaitEvent’
collect2: ld returned 1 exit status
make: *** [grw_test] Error 1
But compiling with the following command is succesfull:
gcc grw_main.c $(bash sdl-config --libs) $(bash sdl-config --cflags) -o
grw_test
What is wrong with the Makefile?---------------------------------
TARGET = grw_test
OBJECTS = grw_main.o
from the SDL-FAQ
SDL_LDFLAGS := $(bash sdl-config --libs)
SDL_CFLAGS := $(bash sdl-config --cflags)
$(TARGET): $(OBJECTS); gcc -o $(TARGET) $(OBJECTS) $(SDL_LDFLAGS)
$(SDL_CFLAGS)
grw_main.o: grw_main.c; gcc -c grw_main.c
Regards, Sven