Home Reverse colors Help
Single page Previous Contents Next

Development with GNU/Linux
14 / 30

GCC and File Extensions

Extension Meaning
.h C header file (not to be compiled or linked).
.c C source code which must be preprocessed.
.i C source code which should not be preprocessed.
.ii C++ source code which should not be preprocessed.
.cc, .cp, .cxx, .cpp, .c++, .C C++ source code which must be preprocessed.
.f, .for, .FOR Fortran source code which should not be preprocessed.
.F, .fpp, .FPP Fortran source code which must be preprocessed (with the traditional preprocessor).
.r Fortran source code which must be preprocessed with a RATFOR preprocessor (not included with GCC).
.s Assembler code.
.S Assembler code which must be preprocessed.
other An object file to be fed straight into linking. Any file name with no recognized suffix is treated this way.

An alternative is to use the -x option of GCC to specify the language of input files explicitly. -x none is the same as the default behaviour, and causes files to be handled according to their extension. Other options include -x c, -x c++, and -x f77.

Yet another alternative is to use g++ and g77. These programs invoke gcc with appropriate options for C++ and Fortran.


Previous Contents Next
Contact