| View previous topic :: View next topic |
| Author |
Message |
AnonymousTipster
Joined: 01 Jul 2005 Posts: 197
|
Posted: Sun Oct 09, 2005 6:52 pm Post subject: C++ R_MIPS_GPREL16 against _impure_ptr |
|
|
I'm in the middle of porting some C++ heavy code, and I think that it's pretty close to finished, as all the cpp files can be compiled into .o files, but when I come to link them all I get this error:
| Code: | | /psp/lib/libstdc++.a(pure.o):../../../../libstdc++-v3/libsupc++/vterminate.cc:69: undefined reference to '_impure_ptr' | and this notice:
| Code: | | /psp/lib/libstdc++.a(vterminate.o):../../../../libstdc++-v3/libsupc++/vterminate.cc:69:relocation truncated to fit: R_MIPS_GPREL16 against '_impure_ptr' |
Now although I've programmed in C++ before, I havent used g++ before, so I don't really know where to go from here.
Any help appreciated. |
|
| Back to top |
|
 |
sherpya

Joined: 03 Oct 2005 Posts: 61
|
Posted: Mon Oct 10, 2005 1:12 am Post subject: |
|
|
| add -G0 to CXXFLAGS (or CPPFLAGS) hmm or perhaps to link flags since is a problem when linking stdc++ it's seams that libstdc++ is not compiled with -G0 |
|
| Back to top |
|
 |
AnonymousTipster
Joined: 01 Jul 2005 Posts: 197
|
Posted: Mon Oct 10, 2005 1:32 am Post subject: |
|
|
I'd already added -G0, but looking at the makefile, I had made a foolish mistake, I'd kept USE_PSPSDK_LIBC = 1 in....
*hits himself with heavy object* |
|
| Back to top |
|
 |
mrbrown
Joined: 17 Jan 2004 Posts: 1536
|
Posted: Mon Oct 10, 2005 2:30 am Post subject: |
|
|
Yes, the recent changes to psplibc make linking to libstdc++ impossible. libstdc++ is built against the newlib headers, which define _impure_ptr. So you have to link against newlib if you want to link against libstdc++.
As far as -G0 goes, it's no longer required for your own source. If you try using -G8 (or just leave -G0 out) and get any linker errors you should bring them up.
In short, do not use psplibc when building a C++ program. |
|
| Back to top |
|
 |
sherpya

Joined: 03 Oct 2005 Posts: 61
|
Posted: Mon Oct 10, 2005 8:50 pm Post subject: |
|
|
| I've managed to link some c++ stuff, buy using gcc instead of g++ and adding -lstdc++, anyway there are some issues with the linker, since linked library are not position indipendant in the command line and sometimes getting the correct sequence is a nightmare |
|
| Back to top |
|
 |
AnonymousTipster
Joined: 01 Jul 2005 Posts: 197
|
Posted: Tue Oct 11, 2005 1:49 am Post subject: |
|
|
Well, for those interested, I've got away from the linker problems by removing PSPSDK_LIBC, and now i'm back to project-related errors, which are very numerous, but hopefully solveable.
If I come up with any more linker problems, i'll post them here. |
|
| Back to top |
|
 |
|