Welcome! Log In Create A New Profile


problems with grrlib buffer

Posted by Oscar_Richard 
problems with grrlib buffer
August 31, 2010 07:53AM
I have made some changes to my program. When I compile it does not recognize the buffer for some reason. Here's the error:

linking ... yosdemo.elf
main.o: In function `main':
e:/yosdemo/source/main.cpp:16: undefined reference to `GRRLIB_buffer'
e:/yosdemo/source/main.cpp:16: undefined reference to `GRRLIB_buffer'
collect2: ld returned 1 exit status
make[1]: *** [/e/yosdemo/yosdemo.elf] Error 1
"make": *** [build] Error 2

#include "player.h" 

extern u16 *GRRLIB_buffer;

int main(int argc, char **argv) {

	GRRLIB_buffer = (u16 *)malloc(256*240*2);
    // Initialise the Graphics & Video subsystem
        // Initialise the Wiimotes

    objOscar Oscar;
    // Loop forever
    while(1) {
        WPAD_ScanPads();  // Scan the Wiimotes

        // If [HOME] was pressed on the first Wiimote, break out of the loop
        if (WPAD_ButtonsDown(0) & WPAD_BUTTON_HOME)  exit(0);//break;

        // ---------------------------------------------------------------------
        // Place your drawing code here
        // ---------------------------------------------------------------------
        GRRLIB_Render();  // Render the frame buffer to the TV

    GRRLIB_Exit(); // Be a good boy, clear the memory allocated by GRRLIB

    exit(0);  // Use exit() to exit a program, do not use 'return' from main()
EDIT: The headers I included are: grrlib.h, stdlib.h. ogcsys.h, gccore.h, wiiuse/wpad.h, ogc/lwp.h, uninstd.h, malloc.h

Is there something to do with the makefile?

Edited 1 time(s). Last edit at 08/31/2010 07:56AM by Oscar_Richard.
Re: problems with grrlib buffer
August 31, 2010 03:31PM
Do you really need GRRLIB_buffer to be extern? Use static instead if all your function are in the same file:
static u16 *GRRLIB_buffer;

BTW, you don't need to create a buffer in your code, if you use GRRLIB???

Edited 1 time(s). Last edit at 09/02/2010 04:48PM by Crayon.
Sorry, only registered users may post in this forum.

Click here to login