Errors compiling SDL

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
NovaCaine
Posts: 34
Joined: Tue Dec 20, 2005 3:31 pm
Location: New Zealand
Contact:

Errors compiling SDL

Post by NovaCaine »

Hey all,

Trying to get my head around how to compile with makefiles, had it working until I rebooted and cant figure out what I've missed.

Basically I've converted a SDL app I'd made to run on my PSP, but when I compile it i get errors about "undefined reference to SDL_RWFromFile" in SDL_image/IMG.c along with a bunch of others in the SDL library. I know its not a bug in their code so what have i missed

I'm currently using this as my makefile:

Code: Select all

TARGET = hello
OBJS = Main.o Application.o TilePlotter.o

CFLAGS = -O2 -G0 -Wall
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)

EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = Hello World

PSPSDK=$(shell psp-config --pspsdk-path)
PSPBIN = $(PSPSDK)/../bin
CFLAGS += `$(PSPBIN)/sdl-config --cflags`
LIBS += `$(PSPBIN)/sdl-config --libs` -lSDL_image -lpng -lz -ljpeg -lm -lstdc++
include $(PSPSDK)/lib/build.mak
EDIT: Hmmm, ok this is really weird.

If I leave in my keyboard code from when it was a PC app it compiles fine, but if I comment it out I get errors? any ideas?
jimparis
Posts: 1145
Joined: Fri Jun 10, 2005 4:21 am
Location: Boston

Re: Errors compiling SDL

Post by jimparis »

NovaCaine wrote:

Code: Select all

LIBS += `$(PSPBIN)/sdl-config --libs` -lSDL_image -lpng -lz -ljpeg -lm -lstdc++
Move SDL_image before the sdl-config part. Link order matters when linking statically as we do on the psp.
NovaCaine
Posts: 34
Joined: Tue Dec 20, 2005 3:31 pm
Location: New Zealand
Contact:

Post by NovaCaine »

thx for that, the whole makefile thing is new to me (usually a windows programmer)
MikeDX
Posts: 30
Joined: Wed Oct 19, 2005 9:24 am

Post by MikeDX »

NovaCaine wrote:thx for that, the whole makefile thing is new to me (usually a windows programmer)
it shows ;)
Post Reply