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 > How to compile via g++ in devkitARM?

#45392 - Kyoji - Fri Jun 10, 2005 4:04 am

I'm extremely new at this, and it would help me immensly if someone provided a simple example of how to compile a .cpp file to an .o file using g++.exe in the devkitARM package.
Thanks for your time.

#45399 - NoMis - Fri Jun 10, 2005 8:20 am

It's exactly how you would compile with gcc.

Code:
arm-elf-g++ -g -Wall -O3 -mcpu=arm7tdmi -mthumb-interwork-c main.cpp -omain.o


The difference is that it automatically adds some C++ specific features like the allocation with new and delete.


NoMis

#45420 - Kyoji - Fri Jun 10, 2005 3:17 pm

Thanks for you help!
But, (and it seems I just cant win lately) I'm getting some errors from the cc1plus.exe:
Code:

C:\devkitPro\Projects\tut1>arm-elf-g++ -g -Wall -O3 -mcpu=arm7tdmi -mthumb-inter
work-c arm7_main.cpp -oarm7_main.o
cc1plus.exe: error: invalid option `thumb-interwork-c'

Checked it over a few times and it appeared to me everything was spelled right, so I'm not too sure what the problem is.

#45427 - strager - Fri Jun 10, 2005 5:19 pm

Add a space between -mthumb-interwork and -c, and it should compile correctly (assuming your code is correct).