undefined error please help me
undefined error please help me
Last edited by dbgtnet on Fri Jan 06, 2006 9:08 am, edited 2 times in total.
Add -lpspgu to your libs.
You should have a line in the makefile like:
That will get rid of the 'undefined reference to sceGu...' messages.
The warning messages at the top (pointer from integer) are because you are using the wrong datatypes, I haven't used the Gu functions much so I can't help you more there.
You should have a line in the makefile like:
Code: Select all
LIBS = -lpspgu
The warning messages at the top (pointer from integer) are because you are using the wrong datatypes, I haven't used the Gu functions much so I can't help you more there.
sceGuTexImage(0,512,512,512,logo_temp);
sceGuDrawArray(GU_TRIANGLES,GU_TEXTURE_32BITF|GU_COLOR_8888|GU_VERTEX_32BITF|GU_TRANSFORM_3D,6,0,vertices);
Both the arguments in red above are pointers. for sceGuTexImage is it a pointer to your texture and for the sceGuDrawArray it is a pointer to your vertices. In your code you have these defined as the datatype int.
So you should either declare your variables as pointers or make a typecast in your code.
sceGuTexImage(0,512,512,512,(const void *)logo_temp);
sceGuDrawArray(GU_TRIANGLES,GU_TEXTURE_32BITF|GU_COLOR_8888|GU_VERTEX_32BITF|GU_TRANSFORM_3D,6,0,(const void *)vertices);
sceGuDrawArray(GU_TRIANGLES,GU_TEXTURE_32BITF|GU_COLOR_8888|GU_VERTEX_32BITF|GU_TRANSFORM_3D,6,0,vertices);
Both the arguments in red above are pointers. for sceGuTexImage is it a pointer to your texture and for the sceGuDrawArray it is a pointer to your vertices. In your code you have these defined as the datatype int.
So you should either declare your variables as pointers or make a typecast in your code.
sceGuTexImage(0,512,512,512,(const void *)logo_temp);
sceGuDrawArray(GU_TRIANGLES,GU_TEXTURE_32BITF|GU_COLOR_8888|GU_VERTEX_32BITF|GU_TRANSFORM_3D,6,0,(const void *)vertices);
Br, Sandberg
I found the error.
But now the flipscreen and initgraphics are undefined reference which library i need to include.
But now the flipscreen and initgraphics are undefined reference which library i need to include.
Code: Select all
TARGET = test
OBJS = main.o graphics.o
CFLAGS = -O2 -G0 -Wall
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)
LIBDIR =
LIBS = -lpspgum -lpspgu -lpng -lz -lm
LDFLAGS =
EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = Pong par moi
PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak
Code: Select all
// Pong PSP par Maxime Dupré Corriveau
// Débuter le 10 Décembre 2005
// Finis le -----------------
//Inclure les librairies PSP
#include <pspdisplay.h>
#include <pspctrl.h>
#include <pspkernel.h>
#include <pspdebug.h>
#include <pspgu.h>
#include <png.h>
#include <stdio.h>
#include "graphics.c"
#define printf pspDebugScreenPrintf // Remplacer les codes pc par ceux
#define clrscr pspDebugScreenClear
#define MAX(X, Y) ((X) > (Y) ? (X) : (Y))
/* Define the module info section */
PSP_MODULE_INFO("Pong Par Moi :D", 0, 1, 1);
/* Define the main thread's attribute value (optional) */
PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER | THREAD_ATTR_VFPU);
int a215 = 0;
int done = 0;
int x1 = 0;
int x2 = 0;
int Image = 0;
int ourImage = 0;
void dump_threadstatus(void);
/* Exit callback */
int exit_callback(int arg1, int arg2, void *common)
{
done = 1;
return 0;
}
/* Callback thread */
int CallbackThread(SceSize args, void *argp)
{
int cbid;
cbid = sceKernelCreateCallback("Exit Callback", exit_callback, NULL);
sceKernelRegisterExitCallback(cbid);
sceKernelSleepThreadCB();
return 0;
}
/* Sets up the callback thread and returns its thread id */
int SetupCallbacks(void)
{
int thid = 0;
thid = sceKernelCreateThread("update_thread", CallbackThread, 0x11, 0xFA0, 0, 0);
if(thid >= 0)
{
sceKernelStartThread(thid, 0, 0);
}
return thid;
}
int main(void)
{
char buffer[200];
Image* ourImage;
initGraphics();
clrscr();
SceCtrlData pad;
pspDebugScreenInit();
SetupCallbacks();
pspDebugScreenSetXY(0, 2);
printf("Je vous pr\x82sente mon jeu de pong.\n Il a \x82t\x82 programmer pour l'expo science.");
printf("\n Pour commencer a jouer veuillez appuyer sur le bouton X.");
while(1){
sceCtrlReadBufferPositive(&pad, 1);
if(pad.Buttons & PSP_CTRL_CROSS){
break;
}
}
clrscr();
pspDebugScreenSetXY(0, 2);
printf("Les boutons du joueur 1 sont : Fleche Haut et Fleche bas.\n Pour le joueur 2 : Triangle et X.");
printf("\n Pour partir le jeu appuyer sur START.");
while(1){
sceCtrlReadBufferPositive(&pad, 1);
if(pad.Buttons & PSP_CTRL_START){
break;
}
}
clrscr();
sprintf(buffer, "background.png");
ourImage = loadImage(buffer);
if (!ourImage) {
//Image load failed
printf("Image load failed!\n");
} else {
int x = 0;
int y = 0;
while (x < 480) {
while (y < 272) {
blitAlphaImageToScreen(0 ,0 ,32 , 32, ourImage, x, y);
y += 32;
}
x += 32;
y = 0;
}
flipScreen();
}
sceDisplayWaitVblankStart();
while(!done){
sceCtrlReadBufferPositive(&pad, 1);
if (pad.Buttons != 0){
if (pad.Buttons & PSP_CTRL_TRIANGLE){
printf("Triangle pressed \n");
x2++;
}
if (pad.Buttons & PSP_CTRL_CROSS){
printf("Cross pressed \n");
x2--;
}
if (pad.Buttons & PSP_CTRL_UP){
printf("Up pressed \n");
x1++;
}
if (pad.Buttons & PSP_CTRL_DOWN){
printf("Down pressed \n");
x1--;
}
clrscr();
printf("Le pad 1 : %d",x1);
printf("\n Le pad 2 : %d",x2);
}
}
sceKernelSleepThread();
return 0;
}