| View previous topic :: View next topic |
| Author |
Message |
cooleyandy
Joined: 02 Jul 2005 Posts: 41
|
Posted: Sun Jul 03, 2005 5:25 pm Post subject: can C++ be used with PSPSDK |
|
|
I'm quite new to the psp dev scene and I must say, it piqued my interest in game programming. I have gotten the psptoolchain to run and I successfully compiled the 'sdktest' program. I've been wanting to port some old c++ programs that I have written but so far all my efforts to compiling any code (using 'make') with .cpp ends with an error that goes something like
/usr/local/pspdev/lib/gcc/psp/4.0.0/../../../../psp/lib/crt0.o: In function `__e
ntrytable':
crt0.S:(.rodata.sceResident+0xc): undefined reference to `module_info'
I tried to rename the sdktest program's main.c to main.cpp and typed in 'make' to compile the program. That is how I got the error.
My background is from development using IDEs and basic command line compilations. This error baffles me, and I've been searching the forums for "c++" and came up with nothing. So after experimenting for a day and still coming up with nothing, I beseech the wise elder programmers of this forum for help. Any pointers besides "search the forums yourself" will be greatly appreciated. |
|
| Back to top |
|
 |
mrbrown
Joined: 17 Jan 2004 Posts: 1536
|
Posted: Sun Jul 03, 2005 6:42 pm Post subject: |
|
|
This error is fixed in Subversion, and it will be fixed in the next beta release (1.0+beta1, which will probably be released tonite or tomorrow).
The solution was also discussed here, so you must've missed this forum in your search :). |
|
| Back to top |
|
 |
cooleyandy
Joined: 02 Jul 2005 Posts: 41
|
Posted: Mon Jul 04, 2005 6:28 am Post subject: |
|
|
| I've tried the solution of changing pspmoduleinfo.h with extern and it works wonderfully. Thanks. I'm wondering why a "C++" search with the search would not turn up anything but I've found my solultion, so I'm happy. |
|
| Back to top |
|
 |
Agoln

Joined: 08 Jun 2005 Posts: 326 Location: Fort Wayne, IN
|
Posted: Wed Jul 06, 2005 12:36 pm Post subject: Not using C++ and getting the error |
|
|
I am not using C++, I am just using ansi-c.
I am just trying to compile:
| Code: | #include <stdio.h>
int main() {
printf("Hello world");
while(1);
return 0;
}
|
Here is my make file:
| Code: |
all:
psp-gcc -g -c Main.c
psp-gcc Main.o -o out -lpsplibc -lpspkernel -lpspdebug
elf2pbp out
|
Here is the output:
| Code: |
psp-gcc -g -c Main.c
psp-gcc Main.o -lpsplibc -lpspkernel -lpspdebug
../../../../psp/lib/crt0.o: In function `__entrytable':
crt0.S:(.rodata.sceResident+0xc): undefined reference to `module_info'
collect2: ld returned 1 exit status
make: *** [all] Error 1
Execution terminated |
Please let me know if it's the same problem. _________________ Lego of my Ago! |
|
| Back to top |
|
 |
emigree
Joined: 09 May 2005 Posts: 5
|
Posted: Wed Jul 06, 2005 3:38 pm Post subject: |
|
|
| Yes, it's the same problem. It goes away it you get a new version of the sdk from svn. Or you could just add an extern to pspmoduleinfo.h as suggested. |
|
| Back to top |
|
 |
mrbrown
Joined: 17 Jan 2004 Posts: 1536
|
Posted: Wed Jul 06, 2005 6:09 pm Post subject: |
|
|
Actually it's not the same as the C++ extern issue and it's not a problem - you must have PSP_MODULE_INFO() declared somewhere in your program in order for your program to run.
We made a provision for autoconf scripts (such as the one used in SDL) so that they can link without PSP_MODULE_INFO(), but be warned that if you forget to declare it, your program will not run.
Note that this is no different than the old way of doing things, except previously the "module_info" was in startup.s.
See any of the PSPSDK samples if you want to see how it's used. |
|
| Back to top |
|
 |
Agoln

Joined: 08 Jun 2005 Posts: 326 Location: Fort Wayne, IN
|
Posted: Thu Jul 07, 2005 12:47 pm Post subject: |
|
|
Ok, I have looked at the sample's a bit, and have gotten to this point.
I modified my code, so now here it is:
| Code: | #include <pspkernel.h>
#include <pspdebug.h>
#include <stdlib.h>
#define printf pspDebugScreenPrintf
PSP_MODULE_INFO("SDKTEST", 0, 1, 1);
int main(void)
{
printf("Hello World");
return 0;
}
|
and here is my make file:
| Code: |
all:
psp-gcc -g -O2 -G0 -Wall -c main.c
psp-gcc -g -O2 -G0 -Wall -lpspkernel -lpsplibc -lpspdebug -o main.o |
and here is the output:
| Code: |
psp-gcc -g -O2 -G0 -Wall -c main.c
psp-gcc -g -O2 -G0 -Wall -lpspkernel -lpsplibc -lpspdebug -o main.o
psp/lib/crt0.o:/home/dev/pspsdk-1.0+beta/sdk/startup/crt0.S:110: undefined reference to `main'
psp/lib/crt0.o: In function `__entrytable':
crt0.S:(.rodata.sceResident+0xc): undefined reference to `module_info'
collect2: ld returned 1 exit status
|
_________________ Lego of my Ago! |
|
| Back to top |
|
 |
mrbrown
Joined: 17 Jan 2004 Posts: 1536
|
Posted: Thu Jul 07, 2005 1:02 pm Post subject: |
|
|
| Code: |
psp-gcc -g -O2 -G0 -Wall -lpspkernel -lpsplibc -lpspdebug -o main.o
|
The -o option specifies the name of the output file. You need to specify one :). |
|
| Back to top |
|
 |
|