#10377 - goro - Wed Sep 03, 2003 5:05 pm
Hi,
I'm working on GBA Junkies tutorial 6 (maps) and when I try to compile I get :
I cut&pasted it so it is exactly as he wrote it :-
Please help!!!!
I'm working on GBA Junkies tutorial 6 (maps) and when I try to compile I get :
Code: |
--------------------Configuration: 2 - Win32 Debug--------------------
Microsoft (R) Program Maintenance Utility Version 6.00.8168.0 Copyright (C) Microsoft Corp 1988-1998. All rights reserved. c:\devkitadv\bin\ld -L c:\devkitadv\lib\gcc-lib\arm-agb-elf\3.0.2\interwork -L c:\devkitadv\arm-agb-elf\lib\interwork -T LinkScript -o 2.elf crt0.o crtbegin.o crtend.o interupt.o 2.o -lstdc++ -lgcc -lc 2.o: In function `main': C:/PROJECTS/GBA/2/2.cpp:90: undefined reference to `sin' C:/PROJECTS/GBA/2/2.cpp:91: undefined reference to `cos' C:/PROJECTS/GBA/2/2.cpp:109: undefined reference to `EnableBackground(Bg*)' C:/PROJECTS/GBA/2/2.cpp:128: undefined reference to `RotateBackground(Bg*, int, int, int, long)' C:/PROJECTS/GBA/2/2.cpp:130: undefined reference to `UpdateBackground(Bg*)' NMAKE : fatal error U1077: 'c:\devkitadv\bin\ld' : return code '0x1' Stop. Error executing NMAKE. 2.exe - 1 error(s), 0 warning(s) |
I cut&pasted it so it is exactly as he wrote it :-
Code: |
////////////////////////////////////////////////////////////////////////// // File: ch6a.cpp // // Description: A program that displays a 128x128 background map // // Author: gbajunkie // // Date: 24th April 2002 // ////////////////////////////////////////////////////////////////////////// #include<math.h> //sign and cos stuff #include"gba.h" //GBA register definitions #include"dispcnt.h" //REG_DISPCNT register #defines #include"keypad.h" //button registers #include"bg.h" //background definitions //my graphics data produced by pcx2sprite program #include"exptiles.h" //data produced by map editor #include"128128map.c" //Rotation variables (don't worry about them here) done in later chapter /**********************************************************************************/ FIXED angle = 0; FIXED zoom = 1<<8; //zoom is a fixed point number FIXED SIN[360]; //Look-Up Tabless for sign and cosign FIXED COS[360]; char RotIndexCounter = 0; //global to keep track of rotation indexes used /**********************************************************************************/ //declare an instance of the background structure Bg bg2; //wait for the screen to stop drawing void WaitForVsync() { while((volatile u16)REG_VCOUNT != 160){} } ///Test for key presses void GetInput() { if(!(*KEYS & KEY_UP)) { bg2.y_scroll++; } if(!(*KEYS & KEY_DOWN)) { bg2.y_scroll--; } if(!(*KEYS & KEY_LEFT)) { bg2.x_scroll++; } if(!(*KEYS & KEY_RIGHT)) { bg2.x_scroll--; } if(!(*KEYS & KEY_L)) { angle--; if(angle<0) angle = 359; } if(!(*KEYS & KEY_R)) { angle++; if(angle > 359) angle = 0; } if(!(*KEYS & KEY_A)) { zoom--; } if(!(*KEYS & KEY_B)) { zoom++; } } ///main entry point from the boot.asm startup file int main() { int index = 0; //generic loop variables u16 loop; u16* temp; //temporary storage pointer //compute my Look up tables (Rotation stuff again) for(loop = 0; loop < 360; loop++) { SIN[loop] = (FIXED)(sin(RADIAN(loop)) * 256); //sin and cos are computed and cast to fixed //fixed COS[loop] = (FIXED)(cos(RADIAN(loop)) * 256); } //set mode 2 and enable sprites and 1d mapping SetMode(MODE_1 | OBJ_ENABLE | OBJ_MAP_1D); //Let us set up the backgroud two structure and enable the background bg2.number = 2; //background number 0-3 bg2.charBaseBlock = 0; //tile data position (right at the start of the available memory on 16Kb boundary) bg2.screenBaseBlock = 28; //map data position on 2Kb boundary bg2.colorMode = BG_COLOR_256; //256-colour background bg2.size = ROTBG_SIZE_128x128; //size of map bg2.mosaic = 0; //not enabled bg2.x_scroll = 120; //scrolling variables bg2.y_scroll = 80; //Point to correct tile and map data, update the Background and Display registers accordingly EnableBackground(&bg2); for(loop = 0; loop < 256; loop++) BGPaletteMem[loop] = exptilesPalette[loop]; //load the background palette into memory for(loop = 0; loop < exptiles_WIDTH * exptiles_HEIGHT /2; loop++) //load tile image data bg2.tileData[loop] = exptilesData[loop]; //load the map image data temp = (u16*)map; for(loop = 0; loop < 16*16/2; loop++) //16x16 tiles /2 because 16 bit copy bg2.mapData[loop] = temp[loop]; //Main Game loop while(1) { GetInput(); //check for input RotateBackground(&bg2,angle,119,79,zoom); //rotates background if required (don't worry about this) WaitForVsync(); //waits for the screen to stop drawing UpdateBackground(&bg2); //make sure registers are updated if anything changes e.g. scrolling } return(0); } |
Please help!!!!