Contents|Index|Previous|Next

cpp, the GNU preprocessor

cpp merges in the #include files, expands all macros definitions, and processes the #ifdef sections. To see the output of cpp, invoke GCC with the -E option, and the preprocessed file will be printed on stdout.

There are two convenient options to assemble handwritten files that require C-style preprocessing. Both options depend on using the compiler driver program, gcc, instead of calling the assembler directly.

- Name the source file using the extension .S (capitalized) rather than .s. gcc recognizes files with this extension as assembly language requiring C-style preprocessing.
- Specify the “source language” explicitly for this situation, using the gcc option, -xassembler-with-cpp.

For more information on cpp, see The C Preprocessor in GNUPro Compiler Tools.