C, C++, Fortran, and JavaThe purpose of this page is to provide useful information for first time C, C++, FORTRAN and Java users on CBS Research Grid. Although this document won't show you how to program, it will help you get started and point you to other useful documentation.
Editing Your ProgramsBefore you use any programming language, you need to be familiar with a text editor, which you will use to write and make changes to your programs. Emacs and Pico are the text editors are available on CBS Research Grid.
Compilers on CBS Research GridThe following table contains information on the compilers that are available on CBS Research Grid.
|Name||Description||Command||Manuals & Documentations|
|GNU Project C – V3.4.6||gcc||At command prompt, type: man gcc;
|GNU Project C++ – V3.4.6||g++||At command prompt, type: man g++
|FORTRAN||GNU Project g77 – V3.4.6||f77||At command prompt, type: man g77
|NAGWare Fortran – V5.0||f95||/apps/NAG/NAGWare_f95-amd64/doc
|Java||Sun Microsystems, V6||java||/apps/jdk/README.html
Example for Using Compilers
The following example demonstrates how to use the compilers to compile an executable file that carries the same file name as the source code:
cc d01ajce.c -I/apps/NAG/cll6a08dgl/include /apps/NAG/cll6a08dgl/lib/libnagc_nag.a -lpthread -lm -o d01ajce.exe
|cc||calls the GNU C compiler|
|d01ajce.c||name of your source file to be compiled. In this case. In this particular case, d01ajce.c is a
sample program you can find under /apps/NAG/dll6a08dgl/examples.
|-I||A flag that indicates what directory will be searched for include files|
|-L||Flag a directory that contains the NAG object library|
|-lnagc||Flag linking other NAG C library|
|-o||A flag to direct output to a different file|
This command will invoke the "cc" compiler, compile a program called "d01ajce.c" search through directory "/apps/NAG/cll6a08dgl/include" and for additional source code and subroutine libraries, and create an executable file "d01ajce.exe."