psppower.h

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

Moderators: cheriff, TyRaNiD

Post Reply
maxx
Posts: 7
Joined: Thu Jul 26, 2007 2:19 am

psppower.h

Post by maxx »

I've included the psppower.h in the code but when I compile it says:

Code: Select all

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

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;
}
User avatar
Raphael
Posts: 646
Joined: Tue Jan 17, 2006 4:54 pm
Location: Germany
Contact:

Post by Raphael »

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
maxx
Posts: 7
Joined: Thu Jul 26, 2007 2:19 am

Post by maxx »

How?
EDIT: Done, now it says:

Code: Select all

main.o&#58; In function `make_top&#40;&#41;'&#58;
main.cpp&#58;&#40;.text+0x50&#41;&#58; undefined reference to `blife'
main.cpp&#58;&#40;.text+0x5c&#41;&#58; undefined reference to `blife'
User avatar
Jim
Posts: 476
Joined: Sat Jul 02, 2005 10:06 pm
Location: Sydney
Contact:

Post by Jim »

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

Code: Select all

int blife;
Jim
maxx
Posts: 7
Joined: Thu Jul 26, 2007 2:19 am

Post by maxx »

Thanks.
Post Reply