Using GCC natively in Linux

From wiki.gp2x.org

Setting up a GCC Environment

Unix-based Operating Systems (Linux)

If you run Unix or Linux, you should have GCC already installed on your machine with most, if not all appropriate libraries. Open up a terminal then copy and paste the following code into a file called hello.c and save it in your home directory:

#include <stdio.h>
int main ()
{
    printf ("Hello, World! Get ready for the GP2X!!\n");
    return 0;
}

In your terminal, type

gcc hello.c -O2 -Wall -s -o hello

and hit enter. This will compile the file hello.c into and executable named hello with the optimisations O2 (Optimisation Level 2) and s (Strip the final executable, to make it smaller). To run the program, type

./hello

and hit enter. The program should print Hello, World! Get ready for the GP2X!! and then exit. Congratulations! You're on your way to being a developer!

Personal tools