| View previous topic :: View next topic |
| Author |
Message |
dospro
Joined: 14 Sep 2006 Posts: 13
|
Posted: Sat Dec 29, 2007 4:38 am Post subject: c++ with on psp? |
|
|
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 |
|
 |
IronAvatar
Joined: 25 Nov 2006 Posts: 23
|
Posted: Sat Dec 29, 2007 4:58 am Post subject: |
|
|
Have you tried adding the following line before including the sdk make file?
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 |
|
 |
dospro
Joined: 14 Sep 2006 Posts: 13
|
Posted: Sat Dec 29, 2007 5:05 am Post subject: |
|
|
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 |
|
 |
IronAvatar
Joined: 25 Nov 2006 Posts: 23
|
Posted: Sat Dec 29, 2007 5:25 am Post subject: |
|
|
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 |
|
 |
jimparis
Joined: 10 Jun 2005 Posts: 1179 Location: Boston
|
Posted: Sat Dec 29, 2007 6:25 am Post subject: |
|
|
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 |
|
 |
dospro
Joined: 14 Sep 2006 Posts: 13
|
Posted: Sun Dec 30, 2007 10:30 am Post subject: |
|
|
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 |
|
 |
seventh
Joined: 21 Jan 2006 Posts: 11
|
Posted: Sun Dec 30, 2007 5:32 pm Post subject: Re: c++ with on psp? |
|
|
| dospro wrote: | | Code: |
OBJS = ${SOURCES:.c=.o}
|
|
Shouldn't that be
| Code: |
OBJS = ${SOURCES:.cpp=.o}
|
? |
|
| Back to top |
|
 |
dospro
Joined: 14 Sep 2006 Posts: 13
|
Posted: Mon Dec 31, 2007 3:58 am Post subject: |
|
|
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 |
|
 |
|