| View previous topic :: View next topic |
| Author |
Message |
Peyote
Joined: 04 Aug 2005 Posts: 6 Location: Holland
|
Posted: Thu Aug 04, 2005 12:41 am Post subject: Problems with cpp files |
|
|
Hello everyone,
During an attempt to recompile some sources that I have created a while ago, I reinstalled the PS2SDK and found out it gives the following linker error when the files are named .cpp (not when they are .c):
undefined reference to __gxx_personality_v0
Now my problem is that I need to use some c++ features and therefore am no longer able to compile the project. Does anybody know how I can fix this?
Also, how can I export symbols using the dvp assembler so the linker will recognize them?
Any help is very much appreciated! Thanks in advance! |
|
| Back to top |
|
 |
Peyote
Joined: 04 Aug 2005 Posts: 6 Location: Holland
|
Posted: Thu Aug 04, 2005 1:59 am Post subject: |
|
|
I found another topic in this list called "C++ problems", where the same thing is discussed. However, adding the line
EE_CXXFLAGS += -fno-exceptions
or adding -lstdc++ both still give problems. The no exceptions flag does not change anything, while the -lstdc++ brings a new huge list of unresolved external symbols ('abort').
Does anybody know how to solve this? |
|
| Back to top |
|
 |
Peyote
Joined: 04 Aug 2005 Posts: 6 Location: Holland
|
Posted: Thu Aug 04, 2005 2:37 am Post subject: |
|
|
Hooray!!! Finally managed to get the C++ code compiled, so the problem is solved...!
^_^
Now all I have to try is get the vsm code linked... |
|
| Back to top |
|
 |
apache37
Joined: 04 Jun 2004 Posts: 76
|
Posted: Thu Aug 04, 2005 3:17 am Post subject: |
|
|
| What was the fix? |
|
| Back to top |
|
 |
Peyote
Joined: 04 Aug 2005 Posts: 6 Location: Holland
|
Posted: Thu Aug 04, 2005 9:19 pm Post subject: |
|
|
The fix was to reinstall the entire SDK and add the -lstdc++ line to the makefile.
Also linking VU code works well now. However, there is a new problem:
When I try to compile projects with multiple files, there are compiler errors when there are c++ files used together with the graph and math libraries. This happens only when I try to access functions outside the cpp file, such as an assembler function from another file.
The errors are as follows:
/cygdrive/c/ps2dev/ee/bin/../lib/gcc-lib/ee/3.2.2/libgcc.a(unwind-dw2.o)(../../gcc/unwind-dw2.c:226: undefined reference to 'strlen'
/cygdrive/c/ps2dev/ee/bin/../lib/gcc-lib/ee/3.2.2/libgcc.a(unwind-dw2-fde.o)(.text+0x5d4): In function 'get_cie_encoding':
../../gcc/unwind-dw2-fde.c:271: undefined reference to 'strlen'
collect2: ld returned 1 exit status
make: *** [vudemo.elf] Error 1
The following flags are set for the linker: -lstdc++ -lc -lgraph -ldma -lmath3d -lmf -lpacket -lc -lsyscall -lkernel
Any ideas how I might fix this? Thanks in advance. |
|
| Back to top |
|
 |
apache37
Joined: 04 Jun 2004 Posts: 76
|
Posted: Fri Aug 05, 2005 4:10 am Post subject: |
|
|
Well you need to make sure the other C header files have the wrapper around them like so:
| Code: | #ifdef __cplusplus
extern "C" {
#endif
.... function defs here
#ifdef __cplusplus
} |
That way you wont get the undefined reference. |
|
| Back to top |
|
 |
carlosn
Joined: 10 Mar 2005 Posts: 38 Location: Orlando, Florida, US
|
Posted: Fri Aug 05, 2005 11:23 pm Post subject: |
|
|
| Peyote wrote: | The fix was to reinstall the entire SDK and add the -lstdc++ line to the makefile.
|
It there a specific makefile? or multiple makefiles? The SDK is made of many packages, be more specific about what packages or at least include the whole path for the makefile(s).
Thank you,
Carlos |
|
| Back to top |
|
 |
Peyote
Joined: 04 Aug 2005 Posts: 6 Location: Holland
|
Posted: Sun Aug 07, 2005 7:11 am Post subject: |
|
|
Thanks for your help!
Unfortunately, it did not fix the problem, since they were already inside.
I am using the makefiles supplied with the PS2SDK, and have tried both the C and C++ versions. The only small difference is the DVP assembler which has been added to it, although it does not make a difference if I leave it out.
In the meantime, I have continued on the VPU side by using C/assembler only. I will try C++ again as soon as I have an idea of how to fix it.
I am trying to unpack data through VU1 to draw polygons using the XGKICK instruction and did the following thing:
I have made a small display list for drawing polygons and it works well when using PATH2/3. The display list is basically a GIFTag with a single 0x0e (A+D) register desription and PACKED data after that (RGBAQ/XYZ2). However, when I use the UNPACK instruction (including NOPs for alignment and FLUSH) the system hangs and needs to be rebooted since Pukklink crashes along with it. This also happens when I access the VU1 memory from the CPU side directly and execute the XGKICK instruction.
The XGKICK instruction is disabled at this moment and the system still hangs after execution of the UNPACK instruction (sometimes it takes a few frames before it hangs). When I change the RGBAQ and XYZ2 registers to zero instead of a useful value (in the display list) the system somehow does not hang anymore....
Any ideas? Please let me know if you know a solution. Thanks! |
|
| Back to top |
|
 |
|