GCC is a popular console-based compiler for *NIX platforms and others. GCC can crosscompile codes for various architectures. Crosscompile means like you generate object codes which can be used for ARM CPU from x86 environment ====================================================================== gcc command of GCC program is used to compile C programs; g++ command of GCC program is used to compile C++ code ====================================================================== GCC can compile various languages like ADA, Java because GCC is designed like that ====================================================================== GCC internally performs following steps; - Preprocessing: processes macros - Compile - Assembly - Linking ====================================================================== ====================================================================== GCC architecture 3 main parts of GCC: front end, middle end, back end - front end converts source file (like C file) into the intermidiate code called Generic if you have C++ code, C++ code is converted into the intermidiate code called Generic Generic is similar concept with the Byte code from Java environment. In GCC environment, if you have Java code, Java code is also converted into the intermidiate code called Generic It means that if you create a new language, what you have to do is to create the intermediate module (AST) which can convert your language source files into the Generic ====================================================================== In middle end, optimization steps (optimization pass1, ..., pass N) are performed And RTL (register transfer language) is created ====================================================================== RTL is converted into the machine code ====================================================================== Simple example of using GCC ====================================================================== 1. Create c source file touch hello.c #include <stdio.h> int main(void) { printf("Hello\n"); } ====================================================================== 2. Compile source file # -o: specify name of object file # hello.c: source file name # -g: adds symbolic information for debugging # -Wall: prints all warning messages (very useful) gcc -o hello hello.c -g -Wall ====================================================================== 3. Execute program ./hello