make output
Code: Select all
psp-gcc -I. -I/opt/toolchains/psp//psp/sdk/include -O2 -G0 -Wall -D_PSP_FW_VERSION=150 -L. -L/opt/toolchains/psp//psp/sdk/lib test.o -lstdc++ -lpspdebug -lpspdisplay -lpspge -lpspctrl -lpspsdk -lc -lpspnet -lpspnet_inet -lpspnet_apctl -lpspnet_resolver -lpsputility -lpspuser -lpspkernel -o test.elf
test.o: In function `main':
test.cpp:(.text+0x30): undefined reference to `XXX::Instance()'
collect2: ld returned 1 exit status
make: *** [test.elf] Error 1
Makefile
Code: Select all
PSPSDK = $(shell psp-config --pspsdk-path)
PSPLIBSDIR = $(PSPSDK)/..
TARGET = test
OBJS = test.o
LIBS = -lstdc++
CFLAGS = -O2 -G0 -Wall
ASFLAGS = $(CFLAGS)
include $(PSPSDK)/lib/build.mak
Code: Select all
#ifndef TEST_H
#define TEST_H
#include "XXX.h"
class Test {
public:
Test();
~Test();
};
#endif // TEST_H
Code: Select all
#include "test.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <pspmoduleinfo.h>
/* Define the module info section */
PSP_MODULE_INFO("test", 0, 1, 0);
int main(int argc, char* argv[]){
Test* test = new Test();
XXX* xxx = XXX::Instance();
return 0;
}
Test::Test(){
}
Test::~Test(){
}
Code: Select all
#ifndef xxx_
#define xxx_
/* Export these Classes */
#pragma GCC visibility push(default)
#include <stdio.h>
using namespace std;
class XXX{
public:
/**
* Get an instance of the XXX class (Singleton Implementation)
*/
static XXX* Instance();
};
#pragma GCC visibility pop
#endif //xxx_
Code: Select all
#include <iostream>
#include "XXX.h"
//#include "XXXImpl.h"
XXX* instance = NULL;
XXX* XXX::Instance(){
if (instance == NULL) instance = new XXX();
return instance;
}