This guide is an introduction to compiling C and Fortran programs. The samples are compiled with the GNU compilers. The Intel and PGI compilers are available.
Using the GNU Compilers
The GNU compilers are in the default path.
GNU C Compiler
- Code: Hello World
[bono:~]$ cat hello.c #include <stdio.h> main() { printf("Hello World!\n"); } [bono:~]$ - Compilation:
[bono:~]$ gcc -o hello-gnu-c hello.c
- Running the code:
[bono:~]$ ./hello-gnu-c Hello World! [bono:~]$
GNU Fortran Compiler
- Code: Hello World
[bono:~]$ cat hello.f C Hello World (Fortran 77) PROGRAM HELLO PRINT*, 'Hello World!' END [bono:~]$ - Compilation:
[bono:~]$ g77 -o hello-gnu-f hello.f
- Running the code:
[bono:~]$ ./hello-gnu-f Hello World! [bono:~]$
Using MPI with GNU Compilers
