next up previous contents
Next: Setting Up Your Environment Previous: Environment Variables

Edlab Compilers, Linkers, and Debuggers

  There are several compilers on the Edlab systems. The most commonly used are the C compiler, the C++ compiler, and the Java compiler.

1.
C - The GNU C compiler can be invoked by typing: gcc [option...] file... On the Alpha systems, the DEC C compiler can be invoked by typing: cc. The source files for C normally have the extension .c. After compilation, the object file has the same name as the source, however, with the extension .o. Arguments whose names end with .s are taken to be assembly source programs and are assembled, producing an .o file. Unless the -c option is specified, cc automatically calls the ld command (see below) to link and load the object files together, finally producing the executable if there are no errors. The executable name will default to a.out unless the -o filename option was specifed. The -c option suppresses the loading phase of the compilation and forces an object file to be produced. Refer to the online man pages for details about all the options.

2.
C++ - The GNU C++ compiler can be invoked by typing: g++ [option...] file... The C and C++ compilers are integrated; g++ is a script to call gcc with options to recognize C++. C++ source files normally use one of the suffixes .C, .cc, .cxx, .cpp, or .c++; preprocessed C++ files use the suffix .ii. Refer to the online man pages for details about all the options.

3.
Linking - The ld command combines several object programs (i.e. .o files) into one, resolves external references and searches libraries. It produces an object module which can be either executed or become the input for a further ld run. The output of ld is left on a.out. This file is made executable only if no errors occurred during the load. The argument routines are linked together in the order specified.

It is possible to specify your own name for the output of the ld command by using the -o option. -t allows you to print the name of each file as it is processed. See the online manual for more details.

4.
Debugger - The GNU debugger gdb is installed on the EDLAB machines. The purpose of a debugger such as gdb is to allow you to see what is going on ``inside'' a program while it executes; or find what a program was doing at the moment it crashed. See the online manual for more details (% man gdb).

5.
Java - The Java compiler, javac, compiles Java source code into Java bytecodes that can then be used by the java interpreter to interpret the code. Java source code must be contained in files with filenames that end with the .java extension

Several versions of JDK (Java Developers Toolkit) are installed in /usr/lib/jvm as well as /exp/rcf/share/X11R5/jdkxxx. The default version is always installed in /usr/bin. To use a different JDK, you need to add its binary directory to your path. In bash you can do it by typing:

export PATH=/usr/lib/jvm/java-6-openjdk-i386/bin:$PATH

For more information read the java and javac man pages.


next up previous contents
Next: Setting Up Your Environment Previous: Environment Variables
Paul A. Sihvonen-Binder
8/8/2014