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.

ASM > How to build simple ASM program?

#174619 - anta40 - Fri Jul 02, 2010 6:07 am

I was reading this tutorial

Then I tried to build the project in Programmers Notepad. Unfortunately, the steps covered in this page is not pretty clear.

So, based on this example:
C:\devkitPro\examples\gba\graphics\ansi_console

I build my project manually (creating the source folder & copying the Makefile)

And this is the output while running make

Code:
> "make"
linking cartridge
c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.4.3/../../../../arm-eabi/lib/thumb/gba_crt0.o: In function `CIDExit':
(.init+0x20c): undefined reference to `main'
collect2: ld returned 1 exit status
make[1]: *** [/c/devkitPro/source/gba/asmtest/asmtest.elf] Error 1
"make": *** [build] Error 2


What went wrong here?

#174621 - Cearn - Fri Jul 02, 2010 6:41 am

This error is usually caused by one of two things
  1. Your source file does not have a main function. But the code from the tutorial has that, so that should be okay.
  2. The compiler can't find your code. If you look in the makefile, there's a variable called SOURCES. This points to the folder(s) with the source files (.c, .cpp, .s, etc). If your file isn't there or does not have the right extension, it won't be used.

#174625 - anta40 - Fri Jul 02, 2010 11:19 am

Renamed the file to asmtest.s (previously: asmtest.asm), then it built successfully.

Strange...