#10636 - goro - Thu Sep 11, 2003 10:11 am
Hi,
I'm doing GBA Junkie's tutorial on maps and BG's and I get
when I try to compile :-
I've tried creating a make.bat file and adding -lm but that doesn't work either. please help
I'm doing GBA Junkie's tutorial on maps and BG's and I get
Code: |
C:/PROJECTS/GBA/4/4.cpp:243: `sin' undeclared (first use this function)
C:/PROJECTS/GBA/4/4.cpp:243: (Each undeclared identifier is reported only once for each function it appears in.) C:/PROJECTS/GBA/4/4.cpp:244: `cos' undeclared (first use this function) |
when I try to compile :-
Code: |
#include"gba.h" //GBA register definitions #include"bg.h" //background definitions #include<math.h> #include"exptiles.h" #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]={0x0000, edited to save forum space, 0xFFFFFB88,}; FIXED COS[360]={0x10000,edited to save forum space, 0xFFF6,}; char RotIndexCounter = 0; //global to keep track of rotation indexes used void EnableBackground(Bg* bg) {edited to save forum space} void UpdateBackground(Bg* bg) {edited to save forum space} void RotateBackground(Bg* bg, int angle,int center_x, int center_y, FIXED zoom) { center_y = (center_y * zoom)>>8; center_x = (center_x * zoom)>>8; bg->DX = ((bg->x_scroll<<8)-center_y*SIN[angle]-center_x*COS[angle]); bg->DY = ((bg->y_scroll<<8)-center_y*COS[angle]+center_x*SIN[angle]); bg->PA = (COS[angle]*zoom)>>8; //cos&sin are LUTs that are .8 fixed numbers bg->PB = (SIN[angle]*zoom)>>8; //zoom is also fixed bg->PC = (-SIN[angle]*zoom)>>8; bg->PD = (COS[angle]*zoom)>>8; } Bg bg2; void WaitForVsync() { while((volatile u16)REG_VCOUNT != 160){}} void GetInput() {edited to save forum space} 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); -edited to save forum space //Main Game loop while(1) { GetInput(); //check for input RotateBackground(&bg2,angle,119,79,zoom); WaitForVsync(); UpdateBackground(&bg2); } return(0); } |
I've tried creating a make.bat file and adding -lm but that doesn't work either. please help