 |
forums.ps2dev.org Homebrew PS2, PSP & PS3 Development Discussions
|
| View previous topic :: View next topic |
| Author |
Message |
Josh1billion

Joined: 12 Jul 2005 Posts: 32 Location: Wisconsin, USA
|
Posted: Wed Jul 13, 2005 8:17 am Post subject: Undeclared functions when compiling... |
|
|
Up until today, I've been using the PS2Dev win32 environment, but now I'm trying to switch to the PSP toolchain.
I have compiled the Hello World and sample SDK sources just fine up to this point, using the PSPDev sdk and the pre-compiled PSP toolchain.
Now I'm trying to compile a Breakout game I've been working on, which I've based off the source code of a BlackJack game (which is also intended for the PS2Dev win32 environment).
I've fixed some errors already when trying to make the switch, but here are some errors I haven't been able to fix yet. I think I need to include some additional PSPSDK include files to fix these errors, so please let me know which ones if I'm right about that.
 _________________ Josh1billion - PHP, C++, PSP programmer. |
|
| Back to top |
|
 |
Agoln

Joined: 08 Jun 2005 Posts: 326 Location: Fort Wayne, IN
|
Posted: Wed Jul 13, 2005 9:49 am Post subject: |
|
|
for the errors about the __encrypt table and module_info, you need to make sure you have the PSP_MODULE_INFO("something", 0, 1, 1);
For the SceCtrl* errors, make sure you include <pspctrl.h>
And for the allegrex, it sounds like someone compiled something with -marc=r4000 instead of allegrex _________________ Lego of my Ago! |
|
| Back to top |
|
 |
Josh1billion

Joined: 12 Jul 2005 Posts: 32 Location: Wisconsin, USA
|
Posted: Wed Jul 13, 2005 11:41 am Post subject: |
|
|
Wow, it sounds like you really know your stuff. :) Thanks much. I will try fixing it with the solutions you suggested soon. First though,
what does "PSP_MODULE_INFO("something", 0, 1, 1); " do (and do I just have it at the start of my main() function, I'm assuming)? And what does the first parameter represent? _________________ Josh1billion - PHP, C++, PSP programmer. |
|
| Back to top |
|
 |
Agoln

Joined: 08 Jun 2005 Posts: 326 Location: Fort Wayne, IN
|
Posted: Wed Jul 13, 2005 12:02 pm Post subject: |
|
|
| Josh1billion wrote: | | what does "PSP_MODULE_INFO("something", 0, 1, 1); " do (and do I just have it at the start of my main() function, I'm assuming)? And what does the first parameter represent? |
You should put it at the beginning of your program, after your #include's and #define's. It is pretty much just a #define itself that tells the startup files what to do. The "something" is a description of your program, usually it's name. the 2nd varible is what type of mode it should be put in. There is THREAD_ATTR_USER and THREAD_ATTR_VFPU, and 0 is kernel mode. the 3rd varible is major version of your program and the 4th varible is minor version. _________________ Lego of my Ago! |
|
| Back to top |
|
 |
Josh1billion

Joined: 12 Jul 2005 Posts: 32 Location: Wisconsin, USA
|
Posted: Wed Jul 13, 2005 12:41 pm Post subject: |
|
|
Alright, I have added the module macro and I have included pspctrl.h.
However, I'm still getting some undefined sce functions here, as you can see:
I took a look at my pspctrl.h file, and it seems rather empty (it only had a few function prototypes total, if I remember correctly, and the functions that the compiler is complaining about were nowhere to be found). _________________ Josh1billion - PHP, C++, PSP programmer. |
|
| Back to top |
|
 |
cwbowron

Joined: 06 May 2005 Posts: 76 Location: East Lansing, MI
|
Posted: Wed Jul 13, 2005 11:37 pm Post subject: |
|
|
Some function names have been changed because I believe they were not the real function names
sceCtrlRead => sceCtrlPeekBufferPositive
sceCtrlSetAnalogMode => sceCtrlSetSamplingMode
sceCtrlInit => sceCtrlSetSamplingCycle
you are probably also going to have to use -lpspctrl when linking. |
|
| Back to top |
|
 |
Josh1billion

Joined: 12 Jul 2005 Posts: 32 Location: Wisconsin, USA
|
Posted: Thu Jul 14, 2005 4:38 am Post subject: |
|
|
Thanks man! :) It's working perfectly now (note: I didn't need to add -lpspctrl to the linker parameters either, just so you know).
Now another question, I might as well ask here rather than start a new topic, can I use standard C include files like Math.h in my PSP game now? Reason being I need to use cos(), sin(), and maybe some others, in my Breakout game. _________________ Josh1billion - PHP, C++, PSP programmer. |
|
| Back to top |
|
 |
Agoln

Joined: 08 Jun 2005 Posts: 326 Location: Fort Wayne, IN
|
Posted: Thu Jul 14, 2005 6:13 am Post subject: |
|
|
make sure in your make file you have -lm for an additional library. _________________ Lego of my Ago! |
|
| Back to top |
|
 |
Josh1billion

Joined: 12 Jul 2005 Posts: 32 Location: Wisconsin, USA
|
Posted: Thu Jul 14, 2005 8:42 am Post subject: |
|
|
Having trouble getting cos(), sin() and sqrt() usable.
| Agoln wrote: | | make sure in your make file you have -lm for an additional library. |
What library do I use for cos(), sin(), and sqrt()? Also which include file do I use for those functions? MSDN says Math.h, but is it different for the PSPSDK? Because I've included Math.h and I'm getting undeclared errors for each of those three functions. _________________ Josh1billion - PHP, C++, PSP programmer. |
|
| Back to top |
|
 |
laichung
Joined: 06 May 2005 Posts: 123
|
Posted: Thu Jul 14, 2005 11:12 am Post subject: |
|
|
including Math.h , header file is not enough. You need to link it library when you compile your program.
Please note that , PSPSDK / toolchain will compile your program without link to library first (that mean it make .c to object .o) , and then link all object and library together to make elf.
So, when any "undeclared errors" come out , the first thing you must do is , check msg from the make process, the makefile and build.mak (from SDK) , make sure you have include the right library.
The other matter is , you cant mix C and CPP file together in your development (this only my experience), because they use different compiler (psp-gcc and psp-g++). I also found that you cant link the CPP object and those CPP library (example , list) by psp-gcc , may be this is because I dont know the command. Since I use CPP for most of the time , so I change the build.mak , make psp-gcc to psp-g++.
finally , if you found any undeclared errors about libc.a and somethings like _read not declare, although mrbrown (say thank you to him) said that is due to usage of outdate toolchain , but I cant solve this error with updating my toolchain. But I know those functions is useless (since they are something like OPEN , READ, which is useless function in psp development). So the way I solve this problem is , declare the undeclared varible in the main program. (example add int _read)
Hope this can help everyone.
p.s. MSDN? You better learn more about GCC and command when you go into PSP development. MSDN is only for MS VS only.
| Josh1billion wrote: | Having trouble getting cos(), sin() and sqrt() usable.
| Agoln wrote: | | make sure in your make file you have -lm for an additional library. |
What library do I use for cos(), sin(), and sqrt()? Also which include file do I use for those functions? MSDN says Math.h, but is it different for the PSPSDK? Because I've included Math.h and I'm getting undeclared errors for each of those three functions. |
|
|
| Back to top |
|
 |
Agoln

Joined: 08 Jun 2005 Posts: 326 Location: Fort Wayne, IN
|
Posted: Thu Jul 14, 2005 11:20 am Post subject: |
|
|
| Josh1billion wrote: | | \What library do I use for cos(), sin(), and sqrt()? |
You use the math library! It is linked by adding a -lm. Open your make file and make sure under libs you have included the -lm in it. _________________ Lego of my Ago! |
|
| Back to top |
|
 |
Josh1billion

Joined: 12 Jul 2005 Posts: 32 Location: Wisconsin, USA
|
Posted: Thu Jul 14, 2005 2:58 pm Post subject: |
|
|
| Agoln wrote: | | Josh1billion wrote: | | \What library do I use for cos(), sin(), and sqrt()? |
You use the math library! It is linked by adding a -lm. Open your make file and make sure under libs you have included the -lm in it. |
I have added "LIBS: -lm" to my make file. Now I'm getting this error.. is it due to an outdated toolchain or what?
 _________________ Josh1billion - PHP, C++, PSP programmer. |
|
| Back to top |
|
 |
Josh1billion

Joined: 12 Jul 2005 Posts: 32 Location: Wisconsin, USA
|
Posted: Fri Jul 15, 2005 4:03 am Post subject: |
|
|
Here's my Makefile of my project if it helps:
| Code: | TARGET = breakout
OBJS = SOLID.o Controller.o Graphics.o
INCDIR =
CFLAGS = -O2 -G0 -Wall
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)
LIBDIR =
LDFLAGS =
LIBS = -lm
EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = Breakout v0.01
include $(PSPSDK)/lib/build.mak
|
_________________ Josh1billion - PHP, C++, PSP programmer. |
|
| Back to top |
|
 |
Josh1billion

Joined: 12 Jul 2005 Posts: 32 Location: Wisconsin, USA
|
Posted: Fri Jul 15, 2005 7:35 am Post subject: |
|
|
Sorry for the triple post, but aha! Fixed! Thanks much to the phpbb Search function.. lol
Here's the solution, as Jim explained here: http://forums.ps2dev.org/viewtopic.php?t=2569&highlight=errno
| Jim wrote: | Until the sdk is fixed for __errno just add
to your main C file. |
_________________ Josh1billion - PHP, C++, PSP programmer. |
|
| 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
|