質問

I am developing a PSP homebrew application and I using the makefile from the exampel but it won't link because the stupid (excuse my French) linker says that oslIsWlanPowrOn is undefined. I know I am linking the right library, plus I am following an example so it should compile. I know most stackoverflow users don't use the oslib or do much psp programming but any help would be appreciated. I have also tried reordering the order of the libs but still states the same linker errors. Anyhow here is the code below:

Makefile

TARGET = main
OBJS = main.o

CFLAGS = -O2 -g -G0 -Wall
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)
LIBDIR =


LIBS= -lpspwlan -losl -lpng -lz -lpspnet \
         -lpsphprm -lpspsdk -lpspctrl -lpsprtc -lpsppower -lpspgu -lpspgum  -lpspaudiolib -lpspaudio  \
         -lpspnet_adhocmatching -lpspnet_adhoc -lpspnet_adhocctl -lm -ljpeg 

LDFLAGS =
EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = PSP Chat
#PSP_EBOOT_ICON = ICON0.PNG
PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak

Error details:

1>------ Build started: Project: PSP Chat, Configuration: Debug Win32 ------
1>  psp-gcc -I. -IC:/pspsdk/psp/sdk/include -O2 -g -G0 -Wall -D_PSP_FW_VERSION=150  -L. -LC:/pspsdk/psp/sdk/lib   main.o -lpspwlan -losl -lpng -lz -lpspnet -lpsphprm -lpspsdk -lpspctrl -lpsprtc -lpsppower -lpspgu -lpspgum  -lpspaudiolib -lpspaudio -lpspnet_adhocmatching -lpspnet_adhoc -lpspnet_adhocctl -lm -ljpeg  -lpspdebug -lpspdisplay -lpspge -lpspctrl -lpspsdk -lc -lpspnet -lpspnet_inet -lpspnet_apctl -lpspnet_resolver -lpsputility -lpspuser -lpspkernel -o main.elf
1>  main.o: In function `main':
1>  c:\Users\Danny\documents\visual studio 2010\Projects\PSP Chat\PSP Chat/main.cpp (24) : undefined reference to `oslIsWlanPowerOn'
1>  c:\Users\Danny\documents\visual studio 2010\Projects\PSP Chat\PSP Chat/main.cpp (52) : undefined reference to `oslIsWlanPowerOn'
1>  C:\pspsdk\bin\make: *** [main.elf] Error 1
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

main.cpp

#include <pspkernel.h>
#include <oslib\oslib.h>
PSP_MODULE_INFO("PSP Chat", 0, 1, 0);

OSL_FONT* font;
int main()
{
    char* screename = (char*)malloc(100);
    int skip = 0;
    printf("Initializing OSL...");
    oslInit(0);
    printf("Loading  Font...");
    oslIntraFontInit(INTRAFONT_CACHE_MED);
    font = oslLoadFontFile("flash0:/font/ltn0.pgf");
    printf("Configuring Font Style...");
    oslIntraFontSetStyle(font, 1.0, RGBA(0, 0, 255, 255), RGBA(0, 0, 0, 0), INTRAFONT_ALIGN_LEFT);
    printf("Setting Font...");
    oslSetFont(font);
    while(!osl_quit)
    {
       if (!skip)
       {
               oslStartDrawing();
               if (oslIsWlanPowerOn())
               {
                   oslDrawString(10, 10, "Please Enter Screename By Pressing X (Client)...");
                   oslDrawString(10, 25, "Please Press O To Act As Server...");
                   if (oslOskIsActive()){
                    oslDrawOsk();
                    if (oslGetOskStatus() == PSP_UTILITY_DIALOG_NONE)
                    {
                        if (oslOskGetResult() == OSL_OSK_CANCEL)
                        {
                            screename = (char*)"Client";
                        }   
                        else
                        {
                            oslOskGetText(screename);
                        }
                        oslEndOsk();
                    }
               }
               else
               {
                   oslDrawString(10, 10, "Please turn on the wlan switch!");
               }
               oslEndDrawing();
           }
           oslEndFrame();
           skip = oslSyncFrame();
           oslReadKeys();
           if (osl_keys->released.cross && oslIsWlanPowerOn())
           {
               oslInitOsk((char*)"Please enter screename!", (char*)"Client", 99, 1, -1);

           }
      }

    }

    sceKernelExitGame();
    return 0;
}
役に立ちましたか?

解決

There was a problem with the installation of the sdk and so I reinstalled it. Voila--it worked. Thanks for everyone who tried to diagnose the problem.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top