Compiling Issues...

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
Sleepy566
Posts: 23
Joined: Thu Dec 28, 2006 2:30 am

Compiling Issues...

Post by Sleepy566 »

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: Select all

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...
Tinnus
Posts: 67
Joined: Sat Jul 29, 2006 1:12 am

Post by Tinnus »

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.
User avatar
dsn
Posts: 47
Joined: Wed Nov 09, 2005 11:48 am
Location: Indianapolis, Indiana, USA

Re: Compiling Issues...

Post by dsn »

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.
Sleepy566
Posts: 23
Joined: Thu Dec 28, 2006 2:30 am

Post by Sleepy566 »

ok... the error message:

Code: Select all

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
if(sceWlanDevIsPowerOn()) printf("WLAN switch is on\n");
else printf("WLAN switch is off\n");
to
if(sceWlanDevIsPowerOn(1)) printf("WLAN switch is on\n");
else printf("WLAN switch is off\n");
then I get this error:

Code: Select all

main.c: In function 'main':
main.c:32: error: too many arguments to function 'sceWlanDevIsPowerOn'
make: *** [main.o] Error 1
and if I change
if(sceWlanDevIsPowerOn(1)) printf("WLAN switch is on\n");
else printf("WLAN switch is off\n");
to
if(sceWlanDevIsPowerOn(0)) printf("WLAN switch is on\n");
else printf("WLAN switch is off\n");
it says

Code: Select all

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...
User avatar
dsn
Posts: 47
Joined: Wed Nov 09, 2005 11:48 am
Location: Indianapolis, Indiana, USA

Post by dsn »

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).
Sleepy566
Posts: 23
Joined: Thu Dec 28, 2006 2:30 am

Post by Sleepy566 »

Ok, it was a lib problem... I totally forgot to check the makefile. Well thanks a ton dsn, it compiled and works fine now!
Post Reply