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.