SDL: Linking under linux

I installed the 1.1.3 rpm…

Hey… I looked at the FAQs -> Linux Questions -> “How do I add SDL to my
project”

I’m using my own Makefile (not autoconf), but:

SDL_CFLAGS := $(shell sdl-config --cflags)
SDL_LDFLAGS := $(shell sdl-config --libs)

… doesn’t make much sense to me…

Your link rule should look something like:

a.out: object.o
$(CC) -o $@ $^ $(SDL_LDFLAGS)

or…

a.out: object.o
$(CC) -o $@ $^ $(shell sdl-config --libs)

See ya!
-Sam Lantinga, Lead Programmer, Loki Entertainment Software

Sam Lantinga wrote:

SDL_CFLAGS := $(shell sdl-config --cflags)
SDL_LDFLAGS := $(shell sdl-config --libs)

… doesn’t make much sense to me…

Your link rule should look something like:

a.out: object.o
$(CC) -o $@ $^ $(SDL_LDFLAGS)

or…

a.out: object.o
$(CC) -o $@ $^ $(shell sdl-config --libs)

Stashing them in make variables once is better than putting the call in
the rule, of course… (invoking the sdl-config only once for each
option instead of at every file compiled!)–
“The only ‘intuitive’ interface is the nipple. After that, it’s
all learned.” – bediger at teal.csn.org (on user interfaces)