cpp-4.8
Preprocess C and C++ source code
SYNOPSIS
cpp-4.8 [-option...] [input-file] [-o output-file]
PARAMETERS
-D name[=defn]
Predefine name as a macro, with optional defn (default 1)
-U name
Cancel predefined or command-line macro name
-I dir
Add dir to include search path end
-iquote dir
Add dir to quote include path
-isystem dir
Add dir to system include path
-idirafter dir
Overlay dir after standard paths
-include file
Process file as if #include "file" at start
-imacros file
Process file for macro definitions only
-undef
Do not predefine system-specific macros
-nostdinc
Ignore standard include directories
-o file
Write output to file instead of stdout
-M
Generate dependency makefile rules (non-phony targets)
-MM
Like -M, ignore system header dependencies
-MD file
Like -M but output to file
-MG
Generate phantom dependencies for missing headers
-MP
Add phony targets to dependency output
-MT target
Specify target in dependency output
-MQ target
Like -MT but quote target for make
-P
Disable linemarkers in output
-C
Preserve comments in output
-CC
Preserve comments even in system headers
-w
Suppress all warnings
-W,[]
Enable specific warnings
-x language
Specify input language (c|c++|objective-c)
-ansi
Support only ISO Standard C syntax
-traditional-cpp
Enable traditional C preprocessor behavior
-dM
Dump all predefined macros
-H
Print include file path hierarchy
DESCRIPTION
The cpp-4.8 command is the GNU C Preprocessor from GCC 4.8, used to expand macros, process include directives, and handle conditional compilation in C, C++, and Objective-C source code. It transforms source files into preprocessed output suitable for the compiler.
Invoked standalone or via compiler drivers like gcc-4.8 -E, it supports #define, #include, #ifdef, #if, #error, and more. Key features include directory include paths, macro definitions/undefinitions, and warning controls. This version aligns with GCC 4.8's support for ISO C90/C99/C11 (partial), C++98/C++11 (partial), and GNU extensions.
Common uses: generating dependency files for make, inspecting macro expansions, or porting code. Output defaults to stdout unless redirected with -o. It searches system and user-specified include paths, with -nostdinc to disable standards.
GCC 4.8's cpp improves diagnostics, trigraph handling, and performance over prior versions, but lacks modern C++20/C2x features.
CAVEATS
Version-specific to GCC 4.8 (2013); may conflict with newer GCC versions. Not installed by default on modern distros. Use gcc-4.8 -E for equivalent. Limited C11/C++11 support; no modules or modern attributes.
INVOCATION NOTES
Often used indirectly: gcc-4.8 -E source.c -o source.i. Standalone for Makefile deps or macro inspection.
STANDARDS COMPLIANCE
ISO C90 standard; partial C99/C11. GNU extensions via -std=gnu (default). Use -ansi for strict mode.
OUTPUT FORMAT
Preprocessed code with linemarkers (#line). Use -P to remove. Comments stripped unless -C.
HISTORY
Introduced with GCC 4.8.0 (May 23, 2013). Enhanced C++11 diagnostics, OpenMP 4.0 support, and LTO improvements. Widely used until GCC 5+ adoption; still available via compat packages in Ubuntu/Debian.


