Here is source, and error, can anyone help.
main.cpp
Code: Select all
#include <pspkernel.h>
#include <pspdebug.h>
#include "PspExitHandler.h"
PSP_MODULE_INFO("testClass_cpp", 0, 1, 1);
int main()
{
pspDebugScreenInit();
PspExitHandler::SetupCallbacks();
pspDebugScreenPrintf("Hello World");
sceKernelSleepThread();
return(0);
}
Code: Select all
#include <pspkernel.h>
#include <pspdebug.h>
class PspExitHandler
{
public:
static int SetupCallbacks(void)
{
int thid = sceKernelCreateThread("update_thread", PspExitHandler::callbackThread, 0x11, 0xFA0, 0, 0);
if (thid >= 0) sceKernelStartThread(thid, 0, 0);
return(0);
}
private:
static int exit_callback(int arg1, int arg2, void * common)
{
sceKernelExitGame();
return(0);
}
static int callbackThread(SceSize args, void *argp)
{
int cbid = sceKernelCreateCallback("Exit Callback", exit_callback, NULL);
sceKernelRegisterExitCallback(cbid);
sceKernelSleepThreadCB();
return(0);
}
};
Code: Select all
class PspExitHandler
{
public:
static int SetupCallbacks(void);
private:
static int exit_callback(int arg1, int arg2, void * common);
static int callbackThread(SceSize args, void *argp);
};
Code: Select all
TARGET = testClass
OBJS = main.o PspExitHandler.o
CFLAGS = -O2 -G0 -Wall
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)
LIBDIR =
LDFLAGS =
LIBS = -lstdc++ -lpng -lz -lm -lpspgu
EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = Test Class
PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak
Code: Select all
psp-g++ -I. -I/usr/local/pspdev/psp/sdk/include -O2 -G0 -Wall -I. -I/usr/local/pspdev/psp/sdk/include -O2 -G0 -Wall -fno-exceptions -fno-rtti -c -o main.o main.cpp
psp-g++ -I. -I/usr/local/pspdev/psp/sdk/include -O2 -G0 -Wall -I. -I/usr/local/pspdev/psp/sdk/include -O2 -G0 -Wall -fno-exceptions -fno-rtti -c -o PspExitHandler.o PspExitHandler.cpp
psp-gcc -I. -I/usr/local/pspdev/psp/sdk/include -O2 -G0 -Wall -L. -L/usr/local/pspdev/psp/sdk/lib main.o PspExitHandler.o -lstdc++ -lpng -lz -lm -lpspgu -lpspdebug -lpspdisplay -lpspge -lpspctrl -lpspsdk -lc -lpspnet -lpspnet_inet -lpspnet_apctl -lpspnet_resolver -lpsputility -lpspuser -lpspkernel -o testClass.elf
main.o In function `main':
main.cpp(.text+0x10): undefined reference to `PspExitHandler::SetupCallbacks()'
collect2: ld returned 2 exit status
make: *** [testClass.elf] Error 1