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.

Beginners > mysterious compile time error

#14197 - dev_vectormatrix - Thu Jan 01, 2004 6:46 pm

getting an error when trying to compile a simple "Hello World!" style program (http://www.loirak.com/gameboy/gbatutor.html)... i can't see why this error is occuring, let alone fix it... i'm not familiar with this compiler but i do have some previous programming experience in c++ and others and i can see nothing faulty in the code itself...



DEBUG OUTPUT AT COMPILE TIME:

C:\prog\Hello>set PATH=c:\devkitadv\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOW
S\System32\Wbem;C:\Program Files\ATI Technologies\ATI Control Panel;c:\hla;c:\hl
a\radasm;c:\hla\radasm\addins;C:\devkitadv\bin ;C:\Program Files\Microsoft Visua
l Studio\Common\Tools\WinNT;C:\Program Files\Microsoft Visual Studio\Common\MSDe
v98\Bin;C:\Program Files\Microsoft Visual Studio\Common\Tools;C:\Program Files\M
icrosoft Visual Studio\VC98\bin

C:\prog\Hello>set GCC_EXEC_PREFIX=c:/devkitadv/lib/gcc-lib/

C:\prog\Hello>gcc -o hello.elf hello.c -lm
gcc: installation problem, cannot exec `as': No such file or directory

C:\prog\Hello>objcopy -O binary hello.elf hello.gba
'objcopy' is not recognized as an internal or external command,
operable program or batch file.

C:\prog\Hello>pause
Press any key to continue . . .

--------------------------------------------------------------------------------

BATCH FILE USED TO COMPILE:

set PATH=c:\devkitadv\bin;%PATH%
set GCC_EXEC_PREFIX=c:/devkitadv/lib/gcc-lib/
gcc -o hello.elf hello.c -lm
objcopy -O binary hello.elf hello.gba
pause

--------------------------------------------------------------------------------

SOURCE:

/* hello.c - Gameboy Advance Tutorial - Loirak Development */
#define RGB16(r,g,b) ((r)+(g<<5)+(b<<10))

int main()
{
char x,y;
unsigned short* Screen = (unsigned short*)0x6000000;
*(unsigned long*)0x4000000 = 0x403; // mode3, bg2 on

// clear screen, and draw a blue back ground
for(x = 0; x<240;x++) //loop through all x
{
for(y = 0; y<160; y++) //loop through all y
{
Screen[x+y*240] = RGB16(0,0,31);
}
}

// draw a white HI on the background
for(x = 20; x<=60; x+=15)
for(y = 30; y<50; y++)
Screen[x+y*240] = RGB16(31,31,31);
for (x = 20; x < 35; x++)
Screen[x+40*240] = RGB16(31,31,31);

while(1){} //loop forever
}

--------------------------------------------------------------------------------

running xp pro, with an old demo version of ms visual c++ 6...
the compiler is installed in C:\devkitadv\ and the source file and .bat are in C:\prog\hello\

#14198 - poslundc - Thu Jan 01, 2004 6:58 pm

It looks like you didn't completely install the dev kit, or it was aborted or something, as one of the programs that comes with it is missing according to your error message.

Try reinstalling it and see what happens.

Dan.

#14199 - DDRfreak121 - Thu Jan 01, 2004 7:06 pm

Try typing this into the DOS prompt (AS found in the tutorial)

PATH=c:\devkitadv\bin;%PATH%

If that doesnt install it....then try reinstalling

#14200 - dev_vectormatrix - Thu Jan 01, 2004 8:08 pm

ah, thankyou very much for your suggestions... i found the problems... one, i needed a ';' after the path in the system path variables... and two, after downloading another copy of all of the zip files and running md5s on all of them i found a difference in one... problem solved... thanks for your help