PS2SDK with C++ problem

Discuss the development of software, tools, libraries and anything else that helps make ps2dev happen.

Moderators: cheriff, Herben

Post Reply
zerocom
Posts: 12
Joined: Tue Jun 08, 2004 7:45 am

PS2SDK with C++ problem

Post by zerocom »

Hi,

I'm trying to get a C++ project to work with PS2SDK, but i have some linking problems. I have to use ee-g++ for linking, but this results in an error with the libc.a, which cannot link fioWrite().

To fix this I already tried to link the whole ps2sdk with g++, but this doesn't fix this problem. Compiling the ps2sdk with g++ doesn't work because of some missing functionality of the g++.

Any solutions?

Bye...
rasmus
Posts: 17
Joined: Wed Jul 21, 2004 9:30 am
Location: Göteborg, Sweden

Post by rasmus »

I pulled my hair slightly before I found a solution to this. The problem is the link order of the libraries. When you link with ee-g++ it adds libstdc++ to the link automatically, but unfortunately in the wrong order. Link with ee-gcc instead and add libstdc++ manually before any other libraries in ps2sdk. Also make sure you use the link order described before with libc include twice.

Like this:

Code: Select all

$ ee-gcc -nostartfiles -Tlinkfile crt0.o main.o -lstdc++ -lc -lkernel -lsyscall -lc
zerocom
Posts: 12
Joined: Tue Jun 08, 2004 7:45 am

Post by zerocom »

Thanks for the info ...

I tried linking using the gcc instead of the g++ but it gaves a linking error with some c++ stuff. But this may be caused by the missing libstdc++.

I'll try your solution and report again ...

Bye...
Post Reply