has anyone managed to build a C++ project?
by that i mean as an example take nem's hello world source, rename *.c to *.cpp and link to libSTDC++. I've tried everything and cant get it to link correctly.
anyone have a solution?
working C++ samples?
working C++ samples?
xSnes9x - Snes9x Emulation for Xbox Consoles
The short answer is that you can't use libstdc++ on the PSP because in the toolchain nem uses libstdc++ was built for the PS2's EE which has a different executable and instruction format than the PSP. See this thread for details: http://forums.ps2dev.org/viewtopic.php?p=11410#11410
The solution is to roll your own GCC toolchain targetted specifically for the PSP's R4K CPU, or wait for someone else to do it.
The solution is to roll your own GCC toolchain targetted specifically for the PSP's R4K CPU, or wait for someone else to do it.
I managed to get ee-g++ working and make a elf. But the thing was, it didn't run on PSPE and since i don't have a 1.0 jap psp, i couldn't try it myself...
But it's very simple, take the hello world example en compile it with ee-g++... put the xmain in a extern "C" { } if it can't find it and add -fno-exceptions to ee-ld...
Maybe it will run on actual hardware, can't test it from here :(
But it's very simple, take the hello world example en compile it with ee-g++... put the xmain in a extern "C" { } if it can't find it and add -fno-exceptions to ee-ld...
Maybe it will run on actual hardware, can't test it from here :(
extern "C" tells the compiler not to mangle the name so that it can be exported correctly to the linker. It does not force it to compile as C code.weak wrote:what exactly is the point in compiling the code as C code with g++? (that's what extern "C" does)
C++ compilers usually mangle the function name by including information about its arguments and such in the exported symbol.
I've been taking a look at the samples from the sdk in svn and in one of my tests I wanted to compile some samples in c++ (it should be just changing the extension to cpp right?). The result was that some projects compiled and linked ok but others (specially when using the psppower lib) wouldn't link but compiled fine. The thing is that it couldn't resolve functions like scePowerIsBatteryExist, scePowerRegisterCallback, etc...
Can somebody tell me what can be happening here? Is it possible that when switching to c++ the declaration of the function is different than the code on the library?
Thank you very much in advance.
Can somebody tell me what can be happening here? Is it possible that when switching to c++ the declaration of the function is different than the code on the library?
Thank you very much in advance.