gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Coding > Compiler error

#84323 - usch_ghost - Sun May 21, 2006 10:32 pm

Hi i tried to cmpile the kubus demo from gbadev but the compiler gives me this error:

Code:
gba_crt0.s:(.init+0x220): undefined reference to `main'


can someone help me to solve this problem?
thx in advance

#84327 - tepples - Sun May 21, 2006 11:08 pm

Is there a function called AgbMain()? If so, rename it to main(). If not, what command lines are you using?
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#84476 - usch_ghost - Mon May 22, 2006 7:40 pm

I?m using an editet .bat file from the pernproject tutorials
this are the arguments:

Code:
@echo off
REM just add  .c file and  .o file to the next two lines
set CFILES= cube.c
set OFILES= cube.o


set GAME= cube
set SPECS=gba_mb.specs

set DEVDIR=G:\devkitpro\devkitARM

PATH=%DEVDIR%\bin;%path%

REM set our paths so the linker knows were to look for the libs
set LIBDIR= %DEVDIR%\arm-elf\lib\interwork


REM set our include directories so the compiler can find our include files
set INCDIR= %DEVDIR%\arm-elf\include
set INCDIR2= ..\..\..\include


REM the compiler and linker flags
set CFLAGS= -I.  -I%INCDIR% -I%INCDIR2% -c -g -O2 -Wall -mcpu=arm7tdmi -mtune=arm7tdmi -fomit-frame-pointer -ffast-math -mthumb -mthumb-interwork

set LDFLAGS=  -mthumb -mthumb-interwork -specs=%SPECS% -L%LIBDIR% -L%LIBDIR2% 




REM Compile the cfiles
arm-elf-gcc  %CFILES% %CFLAGS%

REM link the o files
arm-elf-gcc -o %GAME%.elf  %OFILES% %LDFLAGS%

REM gcc produces .elf exicutables...objcopy to .gba
arm-elf-objcopy -v -O binary %game%.elf %game%.gba

gbafix %game%.gba

REM remove all the ofiles
del %OFILES%
del %game%.elf

pause


but now i get another error -.-"
this is what the compiler says


Code:
cube.c:51: warning: missing braces around initializer
cube.c:51: warning: (near initialization for 'vertices[0]')
cube.c: In function 'RotateAndProject':
cube.c:280: warning: 'dist' is used uninitialized in this function
arm-elf-gcc: argument to '-L' is missing
arm-elf-objcopy: 'cube.elf': No such file
Error opening input file!
G:\devkitPro\projects\examples\kubus\cube.elf konnte nicht gefunden werden
Dr?cken Sie eine beliebige Taste . . .


what does " argument to '-L' is missing" mean?

#84485 - tepples - Mon May 22, 2006 9:48 pm

It means you didn't set %LIBDIR2%.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.