Yea for some reason I keep getting this error.
ERROR
Code:
main.o: In function `Render()':
main.cpp:(.text+0xa0): undefined reference to `CControllerFunc::buttonstatus(int
)'
collect2: ld returned 1 exit status
make: *** [gui_class_tut.elf] Error 1
Here's all the files.
main.cpp
Code:
#include <pspdisplay.h>
#include <pspkernel.h>
#include <pspdebug.h>
#include <pspctrl.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
//#include "main.h"
#include "controller.h"
//#include "menu.h"
CControllerFunc CController;
//#include "menu.h"
//Define module info for this program.
PSP_MODULE_INFO("BLADECONTROLLERTUT", 0, 1, 1);
//Define dprint as pspDebugScreenPrintf.
#define dprint pspDebugScreenPrintf
//Define done integer.
int done = 0;
//Define variable called pad with controller data type.
//Define exit_callback function.
int exit_callback(int arg1, int arg2, void *common)
{
done = 1;
return 0;
}
//Define CallbackThread function.
int CallbackThread(SceSize args, void *argp)
{
int cbid;
cbid = sceKernelCreateCallback("Exit Callback", exit_callback, NULL);
sceKernelRegisterExitCallback(cbid);
sceKernelSleepThreadCB();
return 0;
}
//Define Render function. Contains main code
void Render(){
//Reads the controller buffer.
sceCtrlReadBufferPositive(&CController.pad, 1);
dprint("-STATUS-\t\t-BUTTON-\n\n");
if(CController.buttonstatus(PSP_CTRL_CROSS)){
dprint("-DOWN-\t\t-CROSS-\n\n");
} else {
dprint("- UP -\t\t-CROSS-\n\n");
}
}
//Define SetupCallbacks function
int SetupCallbacks(void)
{
int thid = 0;
thid = sceKernelCreateThread("update_thread", CallbackThread, 0x11, 0xFA0, 0, 0);
if(thid >= 0)
{
sceKernelStartThread(thid, 0, 0);
}
return thid;
}
//Define main function
int main(void)
{
pspDebugScreenInit();//Intialize debug screen mode.
SetupCallbacks();
sceCtrlSetSamplingCycle(0);//Set controller sampling cycle
sceCtrlSetSamplingMode(1);//Set controller sampling mode
pspDebugScreenSetTextColor(0x82DCFD00);//Set debug text color
while(!done){//While the program isn't done
sceDisplayWaitVblankStart();//Wait until the screen is done clearing
Render();//Render
pspDebugScreenClear();//Clear the screen
}
sceKernelExitGame();//Exit game
return 0;//Return 0 since main is an int type
}
controller.cpp
Code:
#include "controller.h"
int CControllerFunc::buttonstatus(int Button)
{
if(pad.Buttons & Button){
pressed = 1;
} else {
pressed = 0;
}
return pressed;
}
controller.h
Code:
#ifndef CONTROLLER_H
#define CONTROLLER_H
class CControllerFunc
{
public:
CControllerFunc();
~CControllerFunc();
int buttonstatus(int Button);
SceCtrlData pad;
private:
int pressed;
};
//Constructor of CControllerFunc
CControllerFunc::CControllerFunc()
{
pressed = 0;
}
//Deconstructor of CControllerFunc - Takes no action
CControllerFunc::~CControllerFunc()
{
}
#endif
Any ideas? Thanks for everything