GNU C/C++ Compiler on the Fatman Server
The GNU C compiler gcc, is probably the most popular free compiler for Unix systems. It supports full ANSI C, traditional C, and GNU C extensions such as nested function support and non-local GOTO statements. The current release of GNU C compiler is Version 2.8.1. The basic command syntax is:
gcc [options | filename]...
Some of the commonly used options:
| Option: | Result: |
| -o {outfile} | Specifies the output of your compiled code. |
| -c | Specifies that you want to compile but not link. |
| -g | Generate debugging info for use with gdb. |
| -I{inc_dir} | Specifies additional user-defined directory for include files. |
| -l{libs} | Use the specified library or libraries when compiling. |
| -Wall | Specify that all types of warnings should be generated when compiling. |
| -ansi | Force full ANSI support. |
| -S | Compile and only generate assembly code. |
Example:
To compile "myprogram.c", you would type:
gcc -o myprogram myprogram.c.
If there were no errors, an executable file named "myprogram" would be generated.
C++ Programs:
Invoking the GNU C++ compiler is very similar to gcc, type:
g++ [options | filename]...
Additional Information:
Further information about gcc and g++ is available via the online man pages. To access the pages, type:
man gcc

