undefined error please help me

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
dbgtnet
Posts: 10
Joined: Sun Dec 25, 2005 12:11 am

undefined error please help me

Post by dbgtnet »

Last edited by dbgtnet on Fri Jan 06, 2006 9:08 am, edited 2 times in total.
danzel
Posts: 182
Joined: Fri Nov 04, 2005 11:03 pm

Post by danzel »

Add -lpspgu to your libs.

You should have a line in the makefile like:

Code: Select all

LIBS = -lpspgu
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.
dbgtnet
Posts: 10
Joined: Sun Dec 25, 2005 12:11 am

Post by dbgtnet »

Thanks that repair that error !!!!
sandberg
Posts: 90
Joined: Wed Oct 05, 2005 1:25 am
Location: Denmark

Post by sandberg »

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);
Br, Sandberg
dbgtnet
Posts: 10
Joined: Sun Dec 25, 2005 12:11 am

Post by dbgtnet »

I have this error now

make: *** No rule to make target 'graphics.o', needed by 'test.elf', stop.
sandberg
Posts: 90
Joined: Wed Oct 05, 2005 1:25 am
Location: Denmark

Post by sandberg »

dbgtnet wrote:I have this error now

make: *** No rule to make target 'graphics.o', needed by 'test.elf', stop.
Would probably be easier to answer if you showed ud your makefile :)
Br, Sandberg
dbgtnet
Posts: 10
Joined: Sun Dec 25, 2005 12:11 am

Post by dbgtnet »

I found the error.
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&#40;X, Y&#41; &#40;&#40;X&#41; > &#40;Y&#41; ? &#40;X&#41; &#58; &#40;Y&#41;&#41;

/* Define the module info section */
PSP_MODULE_INFO&#40;"Pong Par Moi &#58;D", 0, 1, 1&#41;; 

/* Define the main thread's attribute value &#40;optional&#41; */
PSP_MAIN_THREAD_ATTR&#40;THREAD_ATTR_USER | THREAD_ATTR_VFPU&#41;;

int a215 = 0;
int done = 0;
int x1 = 0;
int x2 = 0;
int Image = 0;
int ourImage = 0;

void dump_threadstatus&#40;void&#41;;
 
/* Exit callback */
int exit_callback&#40;int arg1, int arg2, void *common&#41;
&#123;
	done = 1;
	return 0;
&#125;

/* Callback thread */
int CallbackThread&#40;SceSize args, void *argp&#41;
&#123;
	int cbid;

	cbid = sceKernelCreateCallback&#40;"Exit Callback", exit_callback, NULL&#41;;
	sceKernelRegisterExitCallback&#40;cbid&#41;;

	sceKernelSleepThreadCB&#40;&#41;;

	return 0;
&#125;

/* Sets up the callback thread and returns its thread id */
int SetupCallbacks&#40;void&#41;
&#123;
	int thid = 0;

	thid = sceKernelCreateThread&#40;"update_thread", CallbackThread, 0x11, 0xFA0, 0, 0&#41;;
	if&#40;thid >= 0&#41;
	&#123;
		sceKernelStartThread&#40;thid, 0, 0&#41;;
	&#125;

	return thid;
&#125;

int main&#40;void&#41;
&#123;
   char buffer&#91;200&#93;;
   Image* ourImage;
   initGraphics&#40;&#41;;
   clrscr&#40;&#41;;
	SceCtrlData pad;
	pspDebugScreenInit&#40;&#41;;
	SetupCallbacks&#40;&#41;;
	pspDebugScreenSetXY&#40;0, 2&#41;; 
   printf&#40;"Je vous pr\x82sente mon jeu de pong.\n Il a \x82t\x82 programmer pour l'expo science."&#41;;
   printf&#40;"\n  Pour commencer a jouer veuillez appuyer sur le bouton X."&#41;; 
             while&#40;1&#41;&#123;
            sceCtrlReadBufferPositive&#40;&pad, 1&#41;;
           if&#40;pad.Buttons & PSP_CTRL_CROSS&#41;&#123;
                    break;
					          &#125;
       &#125; 
   clrscr&#40;&#41;;
   pspDebugScreenSetXY&#40;0, 2&#41;;  
   printf&#40;"Les boutons du joueur 1 sont &#58; Fleche Haut et Fleche bas.\n Pour le joueur 2 &#58; Triangle et X."&#41;;
   printf&#40;"\n  Pour partir le jeu appuyer sur START."&#41;;
          while&#40;1&#41;&#123;
         sceCtrlReadBufferPositive&#40;&pad, 1&#41;;
           if&#40;pad.Buttons & PSP_CTRL_START&#41;&#123;
                    break;
          &#125;
       &#125; 
	   	   clrscr&#40;&#41;;
		  sprintf&#40;buffer, "background.png"&#41;;
          ourImage = loadImage&#40;buffer&#41;;
		  if &#40;!ourImage&#41; &#123;
                    //Image load failed
          printf&#40;"Image load failed!\n"&#41;;
          &#125; else &#123;
		  int x = 0;
          int y = 0;
		  while &#40;x < 480&#41; &#123;
          while &#40;y < 272&#41; &#123;
		  blitAlphaImageToScreen&#40;0 ,0 ,32 , 32, ourImage, x, y&#41;;
          y += 32;
          &#125;
		  x += 32;
          y = 0;
          &#125;
		  flipScreen&#40;&#41;;
          &#125;
          sceDisplayWaitVblankStart&#40;&#41;;
	while&#40;!done&#41;&#123;
    		sceCtrlReadBufferPositive&#40;&pad, 1&#41;; 
			if &#40;pad.Buttons != 0&#41;&#123;
			if &#40;pad.Buttons & PSP_CTRL_TRIANGLE&#41;&#123;
				printf&#40;"Triangle pressed \n"&#41;;
				x2++;
			&#125; 
			if &#40;pad.Buttons & PSP_CTRL_CROSS&#41;&#123;
				printf&#40;"Cross pressed \n"&#41;;
				x2--;
			&#125; 
			if &#40;pad.Buttons & PSP_CTRL_UP&#41;&#123;
				printf&#40;"Up pressed \n"&#41;;
				x1++;
			&#125; 
			if &#40;pad.Buttons & PSP_CTRL_DOWN&#41;&#123;
				printf&#40;"Down pressed \n"&#41;;
				x1--;
			&#125;   
			clrscr&#40;&#41;;
			 printf&#40;"Le pad 1 &#58; %d",x1&#41;;
			 printf&#40;"\n Le pad 2 &#58; %d",x2&#41;;
		&#125;
	  &#125;
	sceKernelSleepThread&#40;&#41;;	
	return 0; 
&#125;
sandberg
Posts: 90
Joined: Wed Oct 05, 2005 1:25 am
Location: Denmark

Post by sandberg »

I've never heard of them before, so can't help you out there. Also, doing a grep in the spsdev repository doesn't return any mathces for those functions anywhere.

Why do you use those functions ? You must have seen them used somewhere or read about them somewhere ?
Br, Sandberg
weltall
Posts: 310
Joined: Fri Feb 20, 2004 1:56 am
Contact:

Post by weltall »

why you are including a c file :S
just include a header with the list of graphic.c function, then another thing do you have a graphic.c file inside your folder?
dbgtnet
Posts: 10
Joined: Sun Dec 25, 2005 12:11 am

Post by dbgtnet »

This is the error Image
Post Reply