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 

c++ with on psp?

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



Joined: 14 Sep 2006
Posts: 13

PostPosted: Sat Dec 29, 2007 4:38 am    Post subject: c++ with on psp? Reply with quote

Hi. it's me again.
well, i have coded a little application in C++, but it doesn't want to link.
It seems to be compiling quite well but at the time of the linking, it gives me lot of undefined references.
As far as i know i am linking with SDL correctly(i suppose).
The linking errors are known to me. They appear when no libstdc++ is detected. sometihn like:

"undefined reference for operator new"(sorry, it appears in spanish).

This is the makefile i am using.
Quote:

TARGET = biogb

SRCDIR = src
SOURCES = ${SRCDIR}/main.cpp \
${SRCDIR}/cGfx.cpp \
${SRCDIR}/cInput.cpp \
${SRCDIR}/cLibGfx.cpp \
${SRCDIR}/cNet.cpp \
${SRCDIR}/cSound.cpp \
${SRCDIR}/cCpu.cpp \

OBJS = ${SOURCES:.c=.o}

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

EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE =pspBioGB

PSPSDK=$(shell psp-config --pspsdk-path)
PSPBIN = $(PSPSDK)/../bin
CFLAGS += $(shell $(PSPBIN)/sdl-config --cflags)
LIBS += $(shell $(PSPBIN)/sdl-config --libs)
include $(PSPSDK)/lib/build.mak

I hope someone can help me. Thanks
Back to top
View user's profile Send private message
IronAvatar



Joined: 25 Nov 2006
Posts: 23

PostPosted: Sat Dec 29, 2007 4:58 am    Post subject: Reply with quote

Have you tried adding the following line before including the sdk make file?

Code:

USE_PSPSDK_LIBC=1


Or is it reccomended that you use the new libc with the sdl port? It could also be a link order problem which can be a bit of a pain to sort out.
Back to top
View user's profile Send private message
dospro



Joined: 14 Sep 2006
Posts: 13

PostPosted: Sat Dec 29, 2007 5:05 am    Post subject: Reply with quote

Well, the SDL readme says that i should put like that.
but maybe you are right, it may be a linking order problem.
Which i solve how??? Editing the build.mak?
Back to top
View user's profile Send private message
IronAvatar



Joined: 25 Nov 2006
Posts: 23

PostPosted: Sat Dec 29, 2007 5:25 am    Post subject: Reply with quote

Have you tried using the sdk libc? And if so, do you still get the link errors?

If you still get this error, then yes, the only real way to change the link order is to edit the build.mak file. It doesn't have to be a big change though.

I would create a new variable called something like LIB_ALTERNATE and then in the build.mak file, do something like this;

Code:

ifeq ($(LIB_ALTERNATE),)
### Existing script for setting the LIB variable in build.mak
else
    LIBS = $(LIB_ALTERNATE)
endif


Then in your makefile, set the LIB_ALTERNATE variable to use the sdk and sdl libs that you need, and then you can mess around with the link order.

Hope this helps, fixing link order issues is a real pain in the backside :(
Back to top
View user's profile Send private message
jimparis



Joined: 10 Jun 2005
Posts: 1179
Location: Boston

PostPosted: Sat Dec 29, 2007 6:25 am    Post subject: Reply with quote

Huh?
No, just add -lstdc++ -lc to your LIBS line.
Also, search the forums, compiling C++ code has been discussed to death already.
Back to top
View user's profile Send private message
dospro



Joined: 14 Sep 2006
Posts: 13

PostPosted: Sun Dec 30, 2007 10:30 am    Post subject: Reply with quote

Well. that did it. Although there were more errors found about unreferenced SDL_main.
I will have to search about this error.
Thanks for the help
Back to top
View user's profile Send private message
seventh



Joined: 21 Jan 2006
Posts: 11

PostPosted: Sun Dec 30, 2007 5:32 pm    Post subject: Re: c++ with on psp? Reply with quote

dospro wrote:
Code:

OBJS    = ${SOURCES:.c=.o}


Shouldn't that be

Code:

OBJS    = ${SOURCES:.cpp=.o}


?
Back to top
View user's profile Send private message
dospro



Joined: 14 Sep 2006
Posts: 13

PostPosted: Mon Dec 31, 2007 3:58 am    Post subject: Reply with quote

I thought so, but i don't know how nor why it wroks this way.
So i just left it as it was.
Back to top
View user's profile Send private message
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