forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

windows SDL to PSP, SDL_main undefined reference

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
jo3_sum



Joined: 30 Jan 2008
Posts: 17

PostPosted: Sat Jan 03, 2009 10:18 am    Post subject: windows SDL to PSP, SDL_main undefined reference Reply with quote

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
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
psPea



Joined: 01 Sep 2007
Posts: 64

PostPosted: Sat Jan 03, 2009 10:32 am    Post subject: Reply with quote

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
View user's profile Send private message Yahoo Messenger MSN Messenger
J.F.



Joined: 22 Feb 2004
Posts: 2906

PostPosted: Sat Jan 03, 2009 10:45 am    Post subject: Reply with quote

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
View user's profile Send private message AIM Address
jo3_sum



Joined: 30 Jan 2008
Posts: 17

PostPosted: Sat Jan 03, 2009 11:23 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
psPea



Joined: 01 Sep 2007
Posts: 64

PostPosted: Sat Jan 03, 2009 12:25 pm    Post subject: Reply with quote

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
View user's profile Send private message Yahoo Messenger MSN Messenger
jo3_sum



Joined: 30 Jan 2008
Posts: 17

PostPosted: Sat Jan 03, 2009 12:57 pm    Post subject: Reply with quote

I'm using c++
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
psPea



Joined: 01 Sep 2007
Posts: 64

PostPosted: Sat Jan 03, 2009 1:23 pm    Post subject: Reply with quote

exactly
Back to top
View user's profile Send private message Yahoo Messenger MSN Messenger
jo3_sum



Joined: 30 Jan 2008
Posts: 17

PostPosted: Sat Jan 03, 2009 1:33 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group