next up previous contents
Next: Preprocessing Up: Compiling Previous: What is Compiling?   Contents

Compiler Input and Output

The compiler takes source files with extensions like .f and .for (Fortran) and .c, .cpp, and .cxx (C/C++) and produces corresponding .o (Object) files. For example to compile C++:-

g++ -c Animal.cpp

would produce the file Animal.o from Animal.cpp. The corresponding C and Fortran commands are:-

gcc -c Animal.c
g77 -c Animal.for

All three commands g++, gcc and g77 act as an interface to a common GNU compiler.

You cannot run the output from the compiler because:-

So compiler output has to be passed to a second stage: the linker, see section 6.1.4



P.D. Gronbech (IT Staff) 2015-10-02