 |
forums.ps2dev.org Homebrew PS2, PSP & PS3 Development Discussions
|
| View previous topic :: View next topic |
| Author |
Message |
CyberBill
Joined: 26 Jul 2005 Posts: 86 Location: Redmond, WA
|
Posted: Tue Jul 26, 2005 4:09 pm Post subject: Compiling C++ Code |
|
|
Hi, I'm having some trouble compiling C++ code. I took PSPPets Wifi example, cut out a bunch of the stuff he had in it (Aibo & Clie, Jpeg..). C works just fine and dandy, so I went and renamed all the files to cpp and recompiled. It compiles but I think it fails during linking. Here is (some of) the output:
| Code: |
Bill@minibox ~/mywifi-cpp
$ make
psp-g++ -I. -I/usr/local/pspdev/psp/sdk/include -O2 -G0 -Wall -I. -I/usr/local/p
spdev/psp/sdk/include -O2 -G0 -Wall -fno-exceptions -fno-rtti -c -o main.o mai
n.cpp
psp-g++ -I. -I/usr/local/pspdev/psp/sdk/include -O2 -G0 -Wall -I. -I/usr/local/p
spdev/psp/sdk/include -O2 -G0 -Wall -fno-exceptions -fno-rtti -c -o pg_redux.o
pg_redux.cpp
psp-g++ -I. -I/usr/local/pspdev/psp/sdk/include -O2 -G0 -Wall -I. -I/usr/local/p
spdev/psp/sdk/include -O2 -G0 -Wall -fno-exceptions -fno-rtti -c -o nlh.o nlh.
cpp
psp-g++ -I. -I/usr/local/pspdev/psp/sdk/include -O2 -G0 -Wall -I. -I/usr/local/p
spdev/psp/sdk/include -O2 -G0 -Wall -fno-exceptions -fno-rtti -c -o loadutil.o
loadutil.cpp
psp-gcc -I. -I/usr/local/pspdev/psp/sdk/include -O2 -G0 -Wall -I. -I/usr/local/p
spdev/psp/sdk/include -O2 -G0 -Wall -c -o stubs.o stubs.s
stubs.s: Assembler messages:
stubs.s:16: Warning: ignoring changed section attributes for .text.stub
stubs.s:24: Warning: ignoring changed section attributes for .text.stub
stubs.s:55: Warning: ignoring changed section attributes for .text.stub
stubs.s:83: Warning: ignoring changed section attributes for .text.stub
stubs.s:106: Warning: ignoring changed section attributes for .text.stub
stubs.s:116: Warning: ignoring changed section attributes for .text.stub
psp-gcc -I. -I/usr/local/pspdev/psp/sdk/include -O2 -G0 -Wall -L. -L/usr/local/
pspdev/psp/sdk/lib main.o pg_redux.o nlh.o loadutil.o stubs.o -lpspdebug -lps
pdisplay -lpspge -lpspctrl -lpspsdk -lc -lpspuser -lpspkernel -o wifitest.elf
main.o: In function `main':
main.cpp:(.text+0x1d8): undefined reference to `sceUtilityCheckNetParam(int)'
main.cpp:(.text+0x1f0): undefined reference to `sceUtilityGetNetParam(int, unsig
ned int, void*)'
main.cpp:(.text+0x200): undefined reference to `sceUtilityGetNetParam(int, unsig
ned int, void*)'
main.cpp:(.text+0x23c): undefined reference to `sceUtilityGetNetParam(int, unsig
ned int, void*)'
main.cpp:(.text+0x25c): undefined reference to `sceUtilityGetNetParam(int, unsig
ned int, void*)'
main.cpp:(.text+0x284): undefined reference to `sceNetApctlConnect(int)'
main.cpp:(.text+0x298): undefined reference to `sceNetApctlGetState(int*)'
main.cpp:(.text+0x2fc): undefined reference to `sceNetApctlGetState(int*)'
main.cpp:(.text+0x360): undefined reference to `sceNetApctlDisconnect()'
main.cpp:(.text+0x424): undefined reference to `sceNetApctlGetInfo(int, void*)'
main.cpp:(.text+0x4b4): undefined reference to `sceNetInetSocket(int, int, int)'
main.cpp:(.text+0x4f0): undefined reference to `sceNetInetBind(int, void*, int)'
main.cpp:(.text+0x504): undefined reference to `sceNetInetListen(int, int)'
main.cpp:(.text+0x520): undefined reference to `sceNetInetAccept(int, void*, int
*)'
main.cpp:(.text+0x540): undefined reference to `sceNetInetSend(int, void const*,
int, int)'
main.cpp:(.text+0x558): undefined reference to `sceNetInetSend(int, void const*,
int, int)'
main.cpp:(.text+0x5b8): undefined reference to `sceNetInetRecv(int, unsigned cha
r*, int, int)'
|
It just continues on after that with the same type of error except for different functions. I know the functions are basically exported in stubs.s but I dont know how that fits into the big picture.
Any help would be appreciated, thanks. :)
-Bill |
|
| Back to top |
|
 |
Thanhda

Joined: 09 Apr 2005 Posts: 331 Location: Canada
|
Posted: Wed Jul 27, 2005 1:30 am Post subject: |
|
|
you should try taking a simple project like "me" and adding c++ code to it. i have manage to implement a class into the project, and compiles just fine, but my only problem is when i try to instantiate a new object in the scene. take a look. also by updating your psptoolchain it will get rid of a lot more of the errors. the package i used was in the samples/me/basic/ folder
http://forums.ps2dev.org/viewtopic.php?t=2803 _________________ There are 10 types of people in the world: Those who understand binary, and those who don't... |
|
| Back to top |
|
 |
CyberBill
Joined: 26 Jul 2005 Posts: 86 Location: Redmond, WA
|
Posted: Wed Jul 27, 2005 3:31 pm Post subject: |
|
|
I've figured out the problem...
Mixing C/C++ isnt very smart. I needed to add wrappers:
| Code: |
#ifndef PSPWIFI_H
#define PSPWIFI_H
#ifdef __cplusplus
extern "C" {
#endif
//code goes here
#ifdef __cplusplus
}
#endif
#endif /* PSPWIFI_H */
|
Now it compies juuuust fine. YEY CLASSES! YEYYY TEMPLATES!!! Wooooottt!!!
I'm going to try and create a socket library with standard berkeley function names... No idea how it would get compiled into a .a though. :-/ |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|