forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Compiling Issues...

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
Sleepy566



Joined: 28 Dec 2006
Posts: 23

PostPosted: Fri Jan 05, 2007 8:33 am    Post subject: Compiling Issues... Reply with quote

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
View user's profile Send private message
Tinnus



Joined: 29 Jul 2006
Posts: 67

PostPosted: Fri Jan 05, 2007 10:47 am    Post subject: Reply with quote

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
View user's profile Send private message
dsn



Joined: 09 Nov 2005
Posts: 47
Location: Indianapolis, Indiana, USA

PostPosted: Fri Jan 05, 2007 11:02 am    Post subject: Re: Compiling Issues... Reply with quote

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
View user's profile Send private message Send e-mail
Sleepy566



Joined: 28 Dec 2006
Posts: 23

PostPosted: Fri Jan 05, 2007 11:39 am    Post subject: Reply with quote

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
View user's profile Send private message
dsn



Joined: 09 Nov 2005
Posts: 47
Location: Indianapolis, Indiana, USA

PostPosted: Fri Jan 05, 2007 12:25 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
Sleepy566



Joined: 28 Dec 2006
Posts: 23

PostPosted: Sat Jan 06, 2007 5:36 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
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