| View previous topic :: View next topic |
| Author |
Message |
Sleepy566
Joined: 28 Dec 2006 Posts: 23
|
Posted: Fri Jan 05, 2007 8:33 am Post subject: Compiling Issues... |
|
|
Somebody on this forum helped me put together this code, and I was happy, but then it didn't compile.... and the compiler says the issue is that the 'sceWlanDevIsPowerOn' part. Anybody know why? Please and thank you!
| Code: | int main() {
pspDebugScreenInit();
SetupCallbacks();
SceCtrlData pad;
if(sceWlanDevIsPowerOn()) printf("WLAN switch is on\n");
else printf("WLAN switch is off\n");
if(sceUmdCheckMedium(1)) printf("UMD inserted\n");
else printf("No UMD inserted\n");
printf("Project 10 by Sleepy\n");
printf("Detects UMDs and WLAN Switch\n");
printf("Press [X] to exit, and look for P11 soon!\n");
while(1) {
sceCtrlReadBufferPositive(&pad, 1);
if(pad.Buttons & PSP_CTRL_CROSS) {
sceKernelExitGame(); }
}
return 0;
} |
Yeah I know it's basic, but I'm just starting out and playing around with this stuff... |
|
| Back to top |
|
 |
Tinnus
Joined: 29 Jul 2006 Posts: 67
|
Posted: Fri Jan 05, 2007 10:47 am Post subject: |
|
|
Seems like you need to include something (a .h file form the PSPSDK) so the compiler finds the functions(s) you're trying to use.
Hint: Learn general C/C++ before attempting to program for the PSP. At least to grasp basic concepts like headers, functions, libraries, local/global variables, if, for, do and such. _________________ Let's see what the PSP reserves... well, I'd say anything is better than Palm OS. |
|
| Back to top |
|
 |
dsn

Joined: 09 Nov 2005 Posts: 47 Location: Indianapolis, Indiana, USA
|
Posted: Fri Jan 05, 2007 11:02 am Post subject: Re: Compiling Issues... |
|
|
| Sleepy566 wrote: | | the compiler says the issue is that the 'sceWlanDevIsPowerOn' part |
What exactly does the compiler say? An error message would be tremendously helpful. |
|
| Back to top |
|
 |
Sleepy566
Joined: 28 Dec 2006 Posts: 23
|
Posted: Fri Jan 05, 2007 11:39 am Post subject: |
|
|
ok... the error message:
| Code: | main.o: In function 'main':
main.c:(.text+0xd8): undefined reference to 'sceWlanDevIsPowerOn'
main.c:(.text+0xf4): undefined reference to 'sceUmdCheckMedium'
collect2: ld returned 1 exit status
make: *** [Project10.elf] Error 1 |
and if I change
| Quote: | if(sceWlanDevIsPowerOn()) printf("WLAN switch is on\n");
else printf("WLAN switch is off\n"); |
to
| Quote: | if(sceWlanDevIsPowerOn(1)) printf("WLAN switch is on\n");
else printf("WLAN switch is off\n"); |
then I get this error:
| Code: | main.c: In function 'main':
main.c:32: error: too many arguments to function 'sceWlanDevIsPowerOn'
make: *** [main.o] Error 1 |
and if I change
| Quote: | if(sceWlanDevIsPowerOn(1)) printf("WLAN switch is on\n");
else printf("WLAN switch is off\n"); |
to
| Quote: | if(sceWlanDevIsPowerOn(0)) printf("WLAN switch is on\n");
else printf("WLAN switch is off\n"); |
it says
| Code: | main.c: In function 'main':
main.c:32: error: too few arguments to function 'sceWlanDevIsPowerOn'
make: *** [main.o] Error 1 |
I have the correct files in the header, which are pspumd.h and pspwlan.h, so I don't think I'm missing a file there... |
|
| Back to top |
|
 |
dsn

Joined: 09 Nov 2005 Posts: 47 Location: Indianapolis, Indiana, USA
|
Posted: Fri Jan 05, 2007 12:25 pm Post subject: |
|
|
Add these to the LIBS variable in your makefile: -lpspwlan -lpspumd
sceWlanDevIsPowerOn doesn't take any arguments, so sceWlanDevIsPowerOn() is correct--not sceWlanDevIsPowerOn(0) or sceWlanDevIsPowerOn(1). |
|
| Back to top |
|
 |
Sleepy566
Joined: 28 Dec 2006 Posts: 23
|
Posted: Sat Jan 06, 2007 5:36 am Post subject: |
|
|
| Ok, it was a lib problem... I totally forgot to check the makefile. Well thanks a ton dsn, it compiled and works fine now! |
|
| Back to top |
|
 |
|