0

我正在开发一个 PSP 自制应用程序,我使用示例中的 makefile,但它不会链接,因为愚蠢的(请原谅我的法语)链接器说 oslIsWlanPowrOn 是未定义的。我知道我正在链接正确的库,而且我正在关注一个示例,因此它应该可以编译。我知道大多数 stackoverflow 用户不使用 oslib 或做很多 psp 编程,但我们将不胜感激。我也尝试重新排序库的顺序,但仍然指出相同的链接器错误。无论如何这里是下面的代码:

生成文件

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

错误详情:

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 ==========

主文件

#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;
}
4

1 回答 1

1

sdk的安装有问题,所以我重新安装了它。瞧——它奏效了。感谢所有试图诊断问题的人。

于 2011-12-19T15:58:02.227 回答