You are not logged in.
Hello.
Anyway, I'm having making my project with GRRLIB because I get these errors after using the make command:
> "make" template.cpp c:/template/source/template.cpp: In function 'int main()': c:/template/source/template.cpp:104: warning: unused variable 'held1' c:/template/source/template.cpp:105: warning: unused variable 'released1' c:/template/source/template.cpp:108: warning: unused variable 'pressed2' c:/template/source/template.cpp:109: warning: unused variable 'held2' c:/template/source/template.cpp:110: warning: unused variable 'released2' linking ... template.elf template.o: In function `main': c:/template/source/template.cpp:68: undefined reference to `GRRLIB_LoadTexture' c:/template/source/template.cpp:69: undefined reference to `GRRLIB_LoadTexture' c:/template/source/template.cpp:70: undefined reference to `GRRLIB_LoadTexture' c:/template/source/template.cpp:72: undefined reference to `GRRLIB_LoadTexture' c:/template/source/template.cpp:74: undefined reference to `GRRLIB_LoadTexture' template.o:c:/template/source/template.cpp:75: more undefined references to `GRRLIB_LoadTexture' follow template.o: In function `main': c:/template/source/template.cpp:80: undefined reference to `GRRLIB_Init' c:/template/source/template.cpp:116: undefined reference to `GRRLIB_Render' collect2: ld returned 1 exit status make[1]: *** [/c/template/template.elf] Error 1 "make": *** [build] Error 2 > Process Exit Code: 2 > Time Taken: 00:18
Even though I have GRRLIB included.
Does anyone know why I'm getting these errors?
If you need my original code I'll upload/post it on request.
Offline
i suggest you to read this : http://grrlib.santo.fr/forum/viewtopic.php?pid=714#p714
Offline
Thanks a lot. It compiles now, and I've been trying to get it to work for a few days now. I guess next time I'll search.
Also, I have another problem. My Wii freezes up after drawing an image because after the image is displayed I hit HOME and nothing
happens.
Here's where it freezes up:
//>>>>>>>>>>>>>>>>>>>>>START BELOW:>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> GRRLIB_DrawImg(0, 0, tex_menu, 0, 1, 1, 0xFFFFFFFF); GRRLIB_Render(); //For GRRLIB while(1) { if ( pressed1 & WPAD_BUTTON_HOME ) //Go home! {exit(0);} } //>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Here's the whole code in case:
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <malloc.h> #include <ogcsys.h> #include <gccore.h> #include <wiiuse/wpad.h> #include <unistd.h> #include <iostream> //For C++ output: cout<<"text"; using namespace std; //For iostream: takes care of std::cout<<"text"; ir_t ir1; ir_t ir2; static void *xfb = NULL; static GXRModeObj *rmode = NULL; void startmii() { //-------------------------------------------------------------------- VIDEO_Init(); WPAD_Init(); WPAD_SetVRes(0, 640, 480); WPAD_SetDataFormat(WPAD_CHAN_0, WPAD_FMT_BTNS_ACC_IR); WPAD_SetDataFormat(WPAD_CHAN_1, WPAD_FMT_BTNS_ACC_IR); //-------------------------------------------------------------------- rmode = VIDEO_GetPreferredMode(NULL); //-------------------------------------------------------------------- xfb = MEM_K0_TO_K1(SYS_AllocateFramebuffer(rmode)); console_init(xfb,20,20,rmode->fbWidth,rmode->xfbHeight,rmode->fbWidth*VI_DISPLAY_PIX_SZ); //-------------------------------------------------------------------- VIDEO_Configure(rmode); VIDEO_SetNextFramebuffer(xfb); VIDEO_SetBlack(FALSE); VIDEO_Flush(); VIDEO_WaitVSync(); if(rmode->viTVMode&VI_NON_INTERLACE) VIDEO_WaitVSync(); //-------------------------------------------------------------------- } //--------------------------------------------------------------------------------- //To draw an image: //GRRLIB_DrawImg(x_coordinate, y_coordinate, pic_name, rotate_angle, x_scale, y_scale, 0x00000000); #include "GRRLIB/GRRLIB/GRRLIB.h" #include "GRRLIB/lib/libpng/pngu/pngu.h" #include "gfx/intro.h" //Intro picture. #include "gfx/pointer1.h" //Player 1 pointer. #include "gfx/pointer2.h" //Player 2 pointer. #include "gfx/menu_pix/menu.h" #include "gfx/menu_pix/menu_selection_1.h" #include "gfx/menu_pix/menu_selection_2.h" #include "gfx/menu_pix/menu_selection_3.h" #include "gfx/menu_pix/menu_selection_4.h" #include "gfx/menu_pix/menu_selection_5.h" Mtx GXmodelView2D; //Needed by GRRLIB //--------------------------------------------------------------------------------- int main() //--------------------------------------------------------------------------------- { startmii(); //Easily takes care of the standard stuff. GRRLIB_texImg tex_intro = GRRLIB_LoadTexture(intro); GRRLIB_texImg tex_pointer1 = GRRLIB_LoadTexture(pointer1); GRRLIB_texImg tex_pointer2 = GRRLIB_LoadTexture(pointer2); GRRLIB_texImg tex_menu = GRRLIB_LoadTexture(menu); GRRLIB_texImg tex_menu_selection_1 = GRRLIB_LoadTexture(menu_selection_1); GRRLIB_texImg tex_menu_selection_2 = GRRLIB_LoadTexture(menu_selection_2); GRRLIB_texImg tex_menu_selection_3 = GRRLIB_LoadTexture(menu_selection_3); GRRLIB_texImg tex_menu_selection_4 = GRRLIB_LoadTexture(menu_selection_4); GRRLIB_texImg tex_menu_selection_5 = GRRLIB_LoadTexture(menu_selection_5); GRRLIB_Init(); //Used to initialize GRRLIB. while(1) { WPAD_ScanPads(); //Wiimote 1 u32 pressed1 = WPAD_ButtonsDown(0); //For pressed buttons. u32 held1 = WPAD_ButtonsHeld(0); //For held buttons. u32 released1 = WPAD_ButtonsUp(0); //For realeased buttons. u32 pressed2 = WPAD_ButtonsDown(1); //For pressed buttons. u32 held2 = WPAD_ButtonsHeld(1); //For held buttons. u32 released2 = WPAD_ButtonsUp(1); //For realeased buttons. //IR Movement WPAD_IR(0, &ir1); //For Wiimote 1 IR. WPAD_IR(1, &ir2); //For Wiimote 2 IR. //>>>>>>>>>>>>>>>>>>>>>START BELOW:>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> GRRLIB_DrawImg(0, 0, tex_menu, 0, 1, 1, 0xFFFFFFFF); GRRLIB_Render(); //For GRRLIB while(1) { if ( pressed1 & WPAD_BUTTON_HOME ) //Go home! {exit(0);} } //>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> // Wait for the next frame VIDEO_WaitVSync(); } GRRLIB_Exit(); // Be a good boy, clear the memory allocated by GRRLIB return 0; }
I searched the forums, but couldn't find anything specifically relating to this.
Thanks a lot for the help, and you'll probably be hearing a lot from me (but hopefully not), but thanks again,
~BW
Last edited by TPAINROXX (2009-06-15 04:18:17)
Offline
three things,
first, please refere to sample code provided with grrlib, there is no need to define xfb, and other video stuff, grrlib_init, do all this !! in other words, startmii is very useless (except for wpad initialisation), and can provide your problem. USE the TEMPLATE provided code to start your project....
second, i advise you to use the SVN version ( we change a lot of thing)
http://code.google.com/p/grrlib/source/checkout
third, have a look at sample code, (svn or not) there is a way to free texture.
tell us if it correct your probleme
Offline
Alright I done a quick test with displaying the menu and it worked fine. I'm going to try to fix tonight and tomorrow and see if I can get the basic thing running.
Thanks a lot for the help because I would have never known to do some of what you told me. I realize some of it was noobish, but thanks.
I have no problems as of now and WiiMoveIt is on its way...
And... one more thing (a quick general code related question):
If I were to hit HOME then why do I need to include GRRLIB_Exit(); and free(whatever.data); because wouldn't exit(0); mean to end the program there? Or does it complete the program and execute only certain functions? I know this somewhat isn't GRRLIB related, but thanks and sorry for the dumb questions.
This was from:
while(1) { if ( pressed1 & WPAD_BUTTON_HOME ) //Go home! {exit(0);} } //>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> // Wait for the next frame VIDEO_WaitVSync(); } GRRLIB_Exit(); // Be a good boy, clear the memory allocated by GRRLIB return 0;
Last edited by TPAINROXX (2009-06-16 04:35:49)
Offline
On the Wii I think you don't to free the memory, but if you ever program for an other system, be sure to do it. I think GRRLIB_Exit is making sure that next time an app is loaded the screen will appear black for the couple of milliseconds before the app draw on the screen.
In your code instead of exit(0) just put a break; to exit the while loop.
If you use GRRLIB never use VIDEO_* functions in your code.
Offline
Thanks for that I forgot to remove that when I removed the other Video related functions.
You and NoNameNo are very helpful, so thanks for the help.
Offline
If you want it to wait for user input in the inner while you still need to update pressed1.
while(1) { pressed1 = WPAD_ButtonsDown(0); if ( pressed1 & WPAD_BUTTON_HOME ) //Go home! {exit(0);} }
or just remove the while around this section
Offline
eckyecky wrote:
If you want it to wait for user input in the inner while you still need to update pressed1.
Code:
while(1) { pressed1 = WPAD_ButtonsDown(0); if ( pressed1 & WPAD_BUTTON_HOME ) //Go home! {exit(0);} }or just remove the while around this section
In my current code I've removed any
pressed1 = WPAD_ButtonsDown(0);
and now I just use:
if (WPAD_ButtonsDown(0)) {//blah}
,but thanks.
Offline