You are not logged in.
Hello,
Sorry if I don't speak good english, I'm French ^^
When I want to try to compile the lesson 1 in the example of GRRLIB 4, I've got an error at the compilation
linking ... boot.elf main.o: In function `main': c:/devkitPro/examples/wii/boot/source/main.c:19: undefined reference to `GRRLIB_LoadTexture' c:/devkitPro/examples/wii/boot/source/main.c:22: undefined reference to `GRRLIB_Init' c:/devkitPro/examples/wii/boot/source/main.c:79: undefined reference to `GRRLIB_FillScreen' c:/devkitPro/examples/wii/boot/source/main.c:82: undefined reference to `GRRLIB_DrawImg' c:/devkitPro/examples/wii/boot/source/main.c:84: undefined reference to `GRRLIB_Render' c:/devkitPro/examples/wii/boot/source/main.c:97: undefined reference to `GRRLIB_FillScreen' c:/devkitPro/examples/wii/boot/source/main.c:100: undefined reference to `GRRLIB_DrawImg' c:/devkitPro/examples/wii/boot/source/main.c:101: undefined reference to `GRRLIB_Render' collect2: ld returned 1 exit status make[1]: *** [/c/devkitPro/examples/wii/boot/boot.elf] Error 1 "make": *** [build] Error 2 > Process Exit Code: 2 > Time Taken: 00:03
This is my code
#include "GRRLIB.h" #include <stdio.h> #include <gccore.h> #include <wiiuse/wpad.h> #include <stdlib.h> #include "pirate.h" static void *xfb = NULL; static GXRModeObj *rmode = NULL; Mtx GXmodelView2D; //--------------------------------------------------------------------------------- int main(int argc, char **argv) { //--------------------------------------------------------------------------------- GRRLIB_texImg tex_pirate = GRRLIB_LoadTexture(pirate); // Initialise Grrlib GRRLIB_Init(); // Initialise the video system VIDEO_Init(); // This function initialises the attached controllers WPAD_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(); // 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 ); while(1) { u32 wpaddown; // 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 WPAD_ScanPads(); wpaddown = WPAD_ButtonsDown(0); //We fill the screen in white(RGBA format) GRRLIB_FillScreen(0xFFFFFFFF); //Display the image GRRLIB_DrawImg(150, 150, tex_pirate, 0, 1, 1, 0xFFFFFFFF); GRRLIB_Render(); if ( pressed & WPAD_BUTTON_HOME ) exit(0); if ( pressed & WPAD_BUTTON_A ) { printf ("\x1b[10;30H"); printf ("hello World!!"); } if ( pressed & WPAD_BUTTON_UP ) { //We fill the screen in white(RGBA format) GRRLIB_FillScreen(0xFFFFFFFF); //Display the image GRRLIB_DrawImg(150, 150, tex_pirate, 0, 1, 1, 0xFFFFFFFF); GRRLIB_Render(); } if( pressed & WPAD_BUTTON_HOME) { exit(0); } } GRRLIB_Exit(); free(tex_pirate.data); return 0; }
GRRLIB.h and pirate.h are in the same folder of the main.c
Thanks
Offline
In your Makefile be sure to have a good path for GRRLIB:
#--------------------------------------------------------------------------------- # TARGET is the name of the output # BUILD is the directory where object files & intermediate files will be placed # SOURCES is a list of directories containing source code # INCLUDES is a list of directories containing extra header files #--------------------------------------------------------------------------------- GRRLIB := ../../GRRLIB TARGET := $(notdir $(CURDIR)) BUILD := build SOURCES := source source/gfx $(GRRLIB)/GRRLIB $(GRRLIB)/lib/libpng/pngu DATA := data INCLUDES :=
Offline
Thanks but now I've got this message
> "make" make[1]: *** No rule to make target `pngu.o', needed by `/c/devkitPro/examples/wii/boot/boot.elf'. Stop. "make": *** [build] Error 2
I don't know where can be the problem, why 'pngu.o' .
Offline
GRRLIB uses libpng and libjpeg so you need to add the libs and header files (.h) into your project
Your Makefile should look like this:
#--------------------------------------------------------------------------------- # any extra libraries we wish to link with the project #--------------------------------------------------------------------------------- LIBS := -lpng -ljpeg -lz -lfat -lwiiuse -lbte -logc -lm #--------------------------------------------------------------------------------- # list of directories containing libraries, this must be the top level containing # include and lib #--------------------------------------------------------------------------------- LIBDIRS := $(CURDIR)/$(GRRLIB)
Normally your supposed to keep the same file structure as the example and you change your Makefile like the message above and the include path in GRRLIB.c:
#include "../lib/libpng/pngu/pngu.h" #include "../lib/libjpeg/jpeglib.h" #include "GRRLIB.h"
Offline