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.

C/C++ > How to compile a c++ program

#144232 - iameverything - Tue Oct 30, 2007 3:33 pm

Hello everyone.

Can someone tell me the easiest way to make a .cpp file that i have made (and working perfect in my computer) .nds or .gba so i can run it in my nds?

It is not something special. Just a hello world. I just wanna know the easiest way to compile .cpp files to nds compatible.

#144236 - Yota_VGA - Tue Oct 30, 2007 4:24 pm

You can use the gcc and the other tools contained in the devkitpro sdk.

There are many things to do, and that operations are automatically computed, normally, by a software construction tool, like make, scons, aap, autotools, cmake and many many others, but if you want to compile only a file without use a software construction tool you can execute the following commands:

Code:
arm-eabi-g++ file.elf -o file.o -I /path/to/libnds/includes -L /path/to/libnds/libraries -l nds9 -mcpu=arm9tdmi -mtune=arm9tdmi -mthumb-interwork -specs=ds_arm9.specs -DARM9
arm-eabi-objcopy -O binary file.elf file.bin
ndstool -c file.nds -9 file.bin


I think that I don't forget anything, but a thing like this at hand is a pain :)
If you want to develop an homebrew I think that is better that you learn how to use a software construction tool ;)