<< Installation
>> How to get help

Compiling

What about a nice Hello World ?

#include <stdio.h>

main()
{
  printf("Hello World!\n");
}

This was pretty simple ;-) Now we have to compile it. There's a lot of options in gcc but simplest way to compile this would be:

CLI> gcc -o hello hello.c

Simple ?

Here's more options.

Target processor for Motorola family: You can compile plain 68000 code, 68020, 68030, 68040, 68881 (have a look at GCC documentation, either in info or AmigaGuide format, chapter `Invoking Gcc/SubModel Options/M680X0 Options for Motorola specific compilation flags').

CLI> gcc -m68020 -m68881 -o hello hello.c

This will compile your programs using 68020 code and direct calls to math-processor, and will link with accelerated libraries, located in `GCC:lib/lib020'.

Optimization: Either you don't want optimization, or you can provide `-O', which will optimize your code, or if you really want top optimization, use `-O2' flag (for more discussion about optimization, read info or AmigaGuide doc chapter Invoking Gcc/Optimize Options). There's now even a `-O3' optimization option, which will go even further.

CLI> gcc -O2 -o hello hello.c

You'll never have a "Hello World" program running so fast ;-)

Code generation: Perhaps you want to generate resident programs. Flag is -resident, at compile and link stage.

CLI> gcc -resident -o hello hello.c

Of course you can mix all options, resulting in:

CLI> gcc -O2 -m68020 -m68881 -resident -o hello hello.c

This will make a 68020+68881 executable highly optimized and resident.

IMPORTANT: If you only use AmigaDOS functions or you don't want to use ixemul for philosophical reasons, you can get rid of ixemul.library with:

CLI> gcc -noixemul -o foobar foobar.c

provided you have libnix distribution (included with 2.6.0 distribution).



<< Installation >> How to get help