Final Question Thread January 20, 2010 07:50PM | Registered: 14 years ago Posts: 18 |
#include#include #include #include #include static void *xfb = NULL; static GXRModeObj *rmode = NULL; //--------------------------------------------------------------------------------- int main(int argc, char **argv) { //--------------------------------------------------------------------------------- // Initialise the video system VIDEO_Init(); // This function initialises the attached controllers WPAD_Init(); //Disk Drive Light Intialises WIILIGHT_Init(); // Obtain the preferred video mode from the system // This will correspond to the settings in the Wii menu rmode = VIDEO_GetPreferredMode(NULL); // Allocate memory for the display in the uncached region xfb = MEM_K0_TO_K1(SYS_AllocateFramebuffer(rmode)); // Initialise the console, required for printf console_init(xfb,20,20,rmode->fbWidth,rmode->xfbHeight,rmode->fbWidth*VI_DISPLAY_PIX_SZ); // Set up the video registers with the chosen mode VIDEO_Configure(rmode); // Tell the video hardware where our display memory is VIDEO_SetNextFramebuffer(xfb); // Make the display visible VIDEO_SetBlack(FALSE); // Flush the video register changes to the hardware VIDEO_Flush(); // Wait for Video setup to complete VIDEO_WaitVSync(); if(rmode->viTVMode&VI_NON_INTERLACE) VIDEO_WaitVSync(); WIILIGHT_SetLevel(255); // The console understands VT terminal escape codes // This positions the cursor on row 2, column 0 // we can use variables for this with format codes too // e.g. printf ("\x1b[%d;%dH", row, column ); printf("\x1b[2;0H"); printf("Press (A) to toggle the Wii Disk Drive Light"); while(1) { // Call WPAD_ScanPads each loop, this reads the latest controller states WPAD_ScanPads(); // WPAD_ButtonsDown tells us which buttons were pressed in this loop // this is a "one shot" state which will not fire again until the button has been released u32 pressed = WPAD_ButtonsDown(0); // We return to the launcher application via exit if ( pressed & WPAD_BUTTON_HOME ) exit(0); //If the A Button is pressed, then Toggle the Wii Disk Drive Light if ( pressed & WPAD_BUTTON_A ) WIILIGHT_Toggle(); // Wait for the next frame VIDEO_WaitVSync(); } return 0; }
"make" template.c linking ... template.elf template.o: In function `main': c:/devkitPro/examples/wii/template/source/template.c:22: undefined reference to `WIILIGHT_Init' c:/devkitPro/examples/wii/template/source/template.c:51: undefined reference to `WIILIGHT_SetLevel' c:/devkitPro/examples/wii/template/source/template.c:75: undefined reference to `WIILIGHT_Toggle' collect2: ld returned 1 exit status make[1]: *** [/c/devkitPro/examples/wii/template/template.elf] Error 1 "make": *** [build] Error 2 > Process Exit Code: 2 > Time Taken: 00:05
Re: Final Question Thread January 20, 2010 08:11PM | Registered: 15 years ago Posts: 703 |
Quote
khjui
I am now on the edge of giving up wii homebrew coding. I cannot find anything atall that actually works. Or thats helpful in anyway possible. Seeing as the half of you lot' are all experts..well..atleast compared to me..I was wondering how you got started and if you can provide anyhelp and your opinion on weather I should just give it up.
Re: Final Question Thread January 20, 2010 08:18PM | Registered: 14 years ago Posts: 18 |
Quote
scanff
I've not used WIILIGHT but undefined reference means you're not linking in the lib correctly.Quote
khjui
I am now on the edge of giving up wii homebrew coding. I cannot find anything atall that actually works. Or thats helpful in anyway possible. Seeing as the half of you lot' are all experts..well..atleast compared to me..I was wondering how you got started and if you can provide anyhelp and your opinion on weather I should just give it up.
That's not a very good attitude. If you feel that way then maybe you should give up.
Re: Final Question Thread January 20, 2010 08:18PM | Registered: 15 years ago Posts: 175 |
I'm sure it's because you forgot to add the lib in your MakefileQuote
khjui"make" template.c linking ... template.elf template.o: In function `main': c:/devkitPro/examples/wii/template/source/template.c:22: undefined reference to `WIILIGHT_Init' c:/devkitPro/examples/wii/template/source/template.c:51: undefined reference to `WIILIGHT_SetLevel' c:/devkitPro/examples/wii/template/source/template.c:75: undefined reference to `WIILIGHT_Toggle' collect2: ld returned 1 exit status make[1]: *** [/c/devkitPro/examples/wii/template/template.elf] Error 1 "make": *** [build] Error 2 > Process Exit Code: 2 > Time Taken: 00:05
#--------------------------------------------------------------------------------- # any extra libraries we wish to link with the project #--------------------------------------------------------------------------------- LIBS := -lwiiuse -lbte -logc -lm
Re: Final Question Thread January 20, 2010 08:33PM | Registered: 14 years ago Posts: 18 |
Quote
CrayonI'm sure it's because you forgot to add the lib in your MakefileQuote
khjui"make" template.c linking ... template.elf template.o: In function `main': c:/devkitPro/examples/wii/template/source/template.c:22: undefined reference to `WIILIGHT_Init' c:/devkitPro/examples/wii/template/source/template.c:51: undefined reference to `WIILIGHT_SetLevel' c:/devkitPro/examples/wii/template/source/template.c:75: undefined reference to `WIILIGHT_Toggle' collect2: ld returned 1 exit status make[1]: *** [/c/devkitPro/examples/wii/template/template.elf] Error 1 "make": *** [build] Error 2 > Process Exit Code: 2 > Time Taken: 00:05
You need to modify this section:#--------------------------------------------------------------------------------- # any extra libraries we wish to link with the project #--------------------------------------------------------------------------------- LIBS := -lwiiuse -lbte -logc -lm
Re: Final Question Thread January 20, 2010 08:40PM | Registered: 15 years ago Posts: 175 |
Re: Final Question Thread January 20, 2010 08:42PM | Registered: 14 years ago Posts: 18 |
Re: Final Question Thread January 20, 2010 08:43PM | Registered: 15 years ago Posts: 175 |
Re: Final Question Thread January 20, 2010 09:08PM | Registered: 14 years ago Posts: 379 |
Re: Final Question Thread January 21, 2010 03:41AM | Registered: 15 years ago Posts: 30 |
Quote
DaidIt's experience. C/C++ is complex, in the beginning, don't try to understand everything. Some thing just are. You'll find out later why they are that way.Quote
khjuiThanx! One last question, how would I find that out?Quote
Crayon
-lwiilight
Re: Final Question Thread January 21, 2010 04:15PM | Registered: 14 years ago Posts: 18 |
Quote
KsmilerQuote
DaidIt's experience. C/C++ is complex, in the beginning, don't try to understand everything. Some thing just are. You'll find out later why they are that way.Quote
khjuiThanx! One last question, how would I find that out?Quote
Crayon
-lwiilight
Humm, kinda have to side with khjui on this one, if its on the Wiki, it should include what to add to your Makefile so it can reference it. "Some thing just are." just doesn't makes sense to me in this case...
(Cause of this thread, added what you need to write in your Makefile on the installation section of its wiki page).
Don't give up khjui. Lack of documentation is annoying, but just keep trying. Its a great feeling when it actually starts working cause you sticked with it :)
Re: Final Question Thread January 22, 2010 05:01AM | Registered: 14 years ago Posts: 98 |
I don't see any lack of documentation. That's the way these things are shown: assuming you know what you must know. There's plenty of sites out there to learn about makefiles and basic compiler-related terms.Quote
Ksmiler
Lack of documentation is annoying, but just keep trying. Its a great feeling when it actually starts working cause you sticked with it :)
Re: Final Question Thread January 22, 2010 01:04PM | Registered: 15 years ago Posts: 30 |
Quote
Aruskano
There's plenty of sites out there to learn about makefiles and basic compiler-related terms.
Re: Final Question Thread January 23, 2010 01:19AM | Registered: 14 years ago Posts: 552 |
Re: Final Question Thread January 23, 2010 04:11PM | Registered: 15 years ago Posts: 30 |
Re: Final Question Thread January 23, 2010 07:35PM | Registered: 14 years ago Posts: 552 |