| View previous topic :: View next topic |
| Author |
Message |
jo3_sum
Joined: 30 Jan 2008 Posts: 17
|
Posted: Sat Jan 03, 2009 10:18 am Post subject: windows SDL to PSP, SDL_main undefined reference |
|
|
Hi, I have an error when trying to port my SDL windows game to the psp.
I searched on google, but I can't seem to get it working.
Error:
| Code: |
C:\SDLdev\projects\game>make -f makefile.psp
process_begin: CreateProcess((null), C:/pspdev/psp/sdk/../bin/sdl-config --cflag
s, ...) failed.
process_begin: CreateProcess((null), C:/pspdev/psp/sdk/../bin/sdl-config --cflag
s, ...) failed.
process_begin: CreateProcess((null), C:/pspdev/psp/sdk/../bin/sdl-config --libs,
...) failed.
psp-gcc -I. -IC:/pspdev/psp/sdk/include -O2 -G0 -g -Wall -I C:\pspdev\psp\includ
e\freetype2 -L C:\pspdev\psp\lib -DPSP -D_PSP_FW_VERSION=401 -L. -LC:/pspdev/p
sp/sdk/lib -specs=C:/pspdev/psp/sdk/lib/prxspecs -Wl,-q,-TC:/pspdev/psp/sdk/lib/
linkfile.prx C:/pspdev/psp/sdk/lib/prxexports.o -lstdc++ -lc -lSDLmain -lSDL
-lSDL_image -lSDL_ttf -lSDL_mixer -lfreetype -lpng -lz -lm -ljpeg -lpspaudio -lp
sphprm -lpspgu -lpspwlan -lpsppower -lpsprtc -lpspdebug -lpspdisplay -lpspge -
lpspctrl -lpspsdk -lc -lpspnet -lpspnet_inet -lpspnet_apctl -lpspnet_resolver -l
psputility -lpspuser -lpspkernel -o game.elf
C:\pspdev\psp\lib\libSDLmain.a(SDL_psp_main.o): In function `main':
psp/SDL_psp_main.c:178: undefined reference to `SDL_main'
collect2: ld returned 1 exit status
make: *** [game.elf] Error 1
|
Makefile:
| Code: |
TARGET = Game
SRC = main.cpp globalclasses.cpp games.cpp menu.cpp scenes.cpp
OBJ = $(addsuffix .o, $(basename $(SRC)))
INCDIR =
CFLAGS = -O2 -G0 -g -Wall -I C:\pspdev\psp\include\freetype2 -L C:\pspdev\psp\lib -DPSP
PSP_FW_VERSION=401
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS) -c
PSP_VERSION_FW= 401
LIBDIR =
LDFLAGS =
LIBS = -lstdc++ -lc -lSDLmain -lSDL -lSDL_image -lSDL_ttf -lSDL_mixer -lfreetype -lpng -lz -lm -ljpeg -lpspaudio -lpsphprm -lpspgu -lpspwlan -lpsppower -lpsprtc
PSP_EBOOT_ICON = NULL
PSP_EBOOT_PIC1 = NULL
BUILD_PRX=1
EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = Game
PSPSDK=$(shell psp-config --pspsdk-path)
PSPBIN = $(PSPSDK)/../bin
CFLAGS += $(shell $(PSPBIN)/sdl-config --cflags)
CXXFLAGS += $(shell $(PSPBIN)/sdl-config --cflags)
LIBS += $(shell $(PSPBIN)/sdl-config --libs)
include $(PSPSDK)/lib/build.mak
|
Can someone who knows what to do help me, please. |
|
| Back to top |
|
 |
psPea
Joined: 01 Sep 2007 Posts: 64
|
Posted: Sat Jan 03, 2009 10:32 am Post subject: |
|
|
you're looking for sdl-config in the wrong place
if its not in C:/pspdev/psp/bin
then it should be in C:/pspdev/bin
The first time i used sdl i did $(shell $(PSPBIN)/sdl-config --cflags) as well and got the same error
I just changed it to $(shell sdl-config --cflags) and it worked.
I don't know if it will work for both /bin and /psp/bin though. |
|
| Back to top |
|
 |
J.F.
Joined: 22 Feb 2004 Posts: 2906
|
Posted: Sat Jan 03, 2009 10:45 am Post subject: |
|
|
| psPea wrote: | you're looking for sdl-config in the wrong place
if its not in C:/pspdev/psp/bin
then it should be in C:/pspdev/bin
The first time i used sdl i did $(shell $(PSPBIN)/sdl-config --cflags) as well and got the same error
I just changed it to $(shell sdl-config --cflags) and it worked.
I don't know if it will work for both /bin and /psp/bin though. |
Using "$(shell sdl-config --cflags)" runs the system's sdl-config, not the PSP toolchain's sdl-config. You have to put the path in there, and the way he was doing it was correct. Most SDL stuff on the PSP does it just like that. From the failure messages he posted, it's like sdl-config is not installed in the toolchain. He needs to be sure it's there or get rid of it by changing the makefile to have what "$(shell sdl-config --cflags)" would have returned. |
|
| Back to top |
|
 |
jo3_sum
Joined: 30 Jan 2008 Posts: 17
|
Posted: Sat Jan 03, 2009 11:23 am Post subject: |
|
|
I change it to this:
| Code: |
PSPBIN = $(PSPSDK)/../../bin |
the top three errors went away, but I still have the undefined reference error |
|
| Back to top |
|
 |
psPea
Joined: 01 Sep 2007 Posts: 64
|
Posted: Sat Jan 03, 2009 12:25 pm Post subject: |
|
|
you might have to put an
extern "C"
before your main
Last edited by psPea on Sat Jan 03, 2009 1:24 pm; edited 1 time in total |
|
| Back to top |
|
 |
jo3_sum
Joined: 30 Jan 2008 Posts: 17
|
Posted: Sat Jan 03, 2009 12:57 pm Post subject: |
|
|
| I'm using c++ |
|
| Back to top |
|
 |
psPea
Joined: 01 Sep 2007 Posts: 64
|
Posted: Sat Jan 03, 2009 1:23 pm Post subject: |
|
|
| exactly |
|
| Back to top |
|
 |
jo3_sum
Joined: 30 Jan 2008 Posts: 17
|
Posted: Sat Jan 03, 2009 1:33 pm Post subject: |
|
|
Oh, I was thinking it was used the other way for some reason. I'm testing now. I'll update this post to tell you my results.
EDIT:
It compiled. I used HardHat's pspflashcards src as a model. So a thanks to him. |
|
| Back to top |
|
 |
|