forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Help: problem with pointers??

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
chutia



Joined: 29 Nov 2007
Posts: 2

PostPosted: Fri Nov 30, 2007 5:16 pm    Post subject: Help: problem with pointers?? Reply with quote

hi guys, need help I get this compiler error with this simple code :



Code:
$ make
psp-gcc -I. -I/usr/local/pspdev/psp/sdk/include -O2 -G0 -Wall -D_PSP_FW_VERSION=
150  -L. -L/usr/local/pspdev/psp/sdk/lib   main.o  -lpspdebug -lpspdisplay -lpsp
ge -lpspctrl -lpspsdk -lc -lpspnet -lpspnet_inet -lpspnet_apctl -lpspnet_resolve
r -lpsputility -lpspuser -lpspkernel -o temp.elf
main.o: In function `main':
main.c:(.text+0x88): undefined reference to `initGraphics'
main.o:(.rodata.sceModuleInfo+0x24): undefined reference to `__lib_ent_top'
main.o:(.rodata.sceModuleInfo+0x28): undefined reference to `__lib_ent_bottom'
main.o:(.rodata.sceModuleInfo+0x2c): undefined reference to `__lib_stub_top'
main.o:(.rodata.sceModuleInfo+0x30): undefined reference to `__lib_stub_bottom'
collect2: ld returned 1 exit status
make: *** [temp.elf] Error 1


Code:

#include <pspdisplay.h>
#include <pspdebug.h>
#include <pspkernel.h>
#include <time.h>

PSP_MODULE_INFO("temp", 0, 1, 1);

#define printf pspDebugScreenPrintf
/*int displayimg(int xcor, int ycor)
int pollinput(int* xtemp, int* ytemp)*/

/* Exit callback */
int exit_callback(int arg1, int arg2, void *common) {
          sceKernelExitGame();
          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)
{

   SetupCallbacks();
   pspDebugScreenInit();
   initGraphics();
   
   int  x, temp1, temp2;
   int *z;
   int *y;
   
   temp1 = 1;
   temp1 = 2;
   
   y = &temp1;
   z = &temp2;
   
   while(1)
   {
      pspDebugScreenClear();
      
      tempFunc(temp1, temp2);
         
      printf("temp1 value is %i ", *y);
      
      sleep(1);
      for(x=0; x<5; x++)
      {
         sceDisplayWaitVblankStart();
      }
         
   }
      
   sceKernelSleepThread();
   return 0;
}

void tempFunc(int *a, int* b)
{
   *a = *a + *b

}



Code:

TARGET = temp
OBJS = main.o

CFLAGS = -O2 -G0 -Wall
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)

LIBDIR =

LDFLAGS =

EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = TEMP

PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak


I have searched previous posts without success.
Might be a problem with the make file??
Back to top
View user's profile Send private message
terryxq



Joined: 12 Oct 2005
Posts: 16

PostPosted: Sat Dec 01, 2007 1:13 am    Post subject: Reply with quote

There is no definition & implement of the function "initGraphics" in your main.c but you called it.
Back to top
View user's profile Send private message
J.F.



Joined: 22 Feb 2004
Posts: 2906

PostPosted: Sat Dec 01, 2007 6:54 am    Post subject: Reply with quote

You've clearly been looking at tutorial that use graphics.c and graphics.h, but have forgotten to include those in your project. At the least, put those two files in your project folder and add graphics.o to the OBJS list.
Back to top
View user's profile Send private message AIM Address
chutia



Joined: 29 Nov 2007
Posts: 2

PostPosted: Sat Dec 01, 2007 10:41 am    Post subject: Reply with quote

thanks for the reply guys,
firstly the make file was correct but in the c file there were lots of little mistakes I made, like not deleting the initgraphics(), sending the wrong variables to the function etc.
I have only been programming in C for a little while and just started on the psp this week.I think this explains it ;)
Problems solved for now.... thanks again.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group