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 

psppower.h

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



Joined: 26 Jul 2007
Posts: 7

PostPosted: Sat Jul 28, 2007 2:12 am    Post subject: psppower.h Reply with quote

I've included the psppower.h in the code but when I compile it says:
Code:
main.o: In function `make_top()':
main.cpp:(.text+0x8): undefined reference to `scePowerIsBatteryCharging'
main.cpp:(.text+0x40): undefined reference to `scePowerGetBatteryLifePercent'
main.cpp:(.text+0x50): undefined reference to `blife'
main.cpp:(.text+0x5c): undefined reference to `blife'
main.o: In function `main':
main.cpp:(.text+0x108): undefined reference to `scePowerIsBatteryCharging'
collect2: ld returned 1 exit status
make: *** [hello.elf] Error 1


My code:


Code:
int make_top(void)
{
    int extern blife;   

    if (scePowerIsBatteryCharging())
    {
        printf("GFXChanger 0.1 by MaX911                          battery: charging \n");
        printf("-------------------------------------------------------------------");
        return 0;
    }

    blife = scePowerGetBatteryLifePercent();

    printf("GFXChanger 0.1 by MaX911                                battery: %s \n", blife);
    printf("-------------------------------------------------------------------");
    return 0;
}


int main()
{
    pspDebugScreenInit();
    SetupCallbacks();
    SceCtrlData pad;

    make_top();
    if (scePowerIsLowBattery)
    {
        printf("\n\n\n\n\n\n\n          Battery Power is low, please plug in charger to continue.");       

        while (1)
        {
            if (scePowerIsBatteryCharging())
            {
                break;
            }
        }
        pspDebugScreenClear();
        make_top();
        printf("\n\n\n\n\n\n\n          Charger detected, press [X] to continue.");
        sceCtrlReadBufferPositive(&pad, 1);
        if (pad.Buttons & PSP_CTRL_CROSS)
        {
            pspDebugScreenClear();
            make_top();
        }
    }
   
    sceKernelSleepThread();   

    return 0;
}
Back to top
View user's profile Send private message
Raphael



Joined: 17 Jan 2006
Posts: 646
Location: Germany

PostPosted: Sat Jul 28, 2007 3:10 am    Post subject: Reply with quote

You actually need to link the library psppower too.
_________________
<Don't push the river, it flows.>
http://wordpress.fx-world.org - my devblog
http://wiki.fx-world.org - VFPU documentation wiki

Alexander Berl
Back to top
View user's profile Send private message Visit poster's website
maxx



Joined: 26 Jul 2007
Posts: 7

PostPosted: Sat Jul 28, 2007 9:07 am    Post subject: Reply with quote

How?
EDIT: Done, now it says:

Code:
main.o: In function `make_top()':
main.cpp:(.text+0x50): undefined reference to `blife'
main.cpp:(.text+0x5c): undefined reference to `blife'
Back to top
View user's profile Send private message
Jim



Joined: 02 Jul 2005
Posts: 487
Location: Sydney

PostPosted: Sat Jul 28, 2007 9:59 am    Post subject: Reply with quote

Quote:
int extern blife;

So, where is blife defined?
I expect you just want
Code:
int blife;


Jim
_________________
http://www.dbfinteractive.com
Back to top
View user's profile Send private message Visit poster's website
maxx



Joined: 26 Jul 2007
Posts: 7

PostPosted: Sat Jul 28, 2007 10:08 am    Post subject: Reply with quote

Thanks.
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