CPP(1)

πŸ“¦
version 13.5.0+git10516 Β· 2 versions
, in opensuse-leap 16.0

✨ CPP(1) β€” the GNU C Preprocessor ✨

okay bestie, sit down, hydrate, because today we're learning cpp β€” the GNU C Preprocessor β€” and honestly? she's iconic. This is the CPP(1) page from the GNU manual, chapter one of four. Buckle up. πŸŽ€


🌸 NAME 🌸

cpp β€” The C Preprocessor πŸ’–


πŸ¦‹ SYNOPSIS πŸ¦‹

cpp [-Dmacro[=defn]...] [-Umacro]
    [-Idir...] [-iquotedir...]
    [-M|-MM] [-MG] [-MF filename]
    [-MP] [-MQ target...]
    [-MT target...]
    infile [[-o] outfile]

lowkey important: that list is only the most useful options, not the whole menu. Scroll down for the fuller list of preprocessor-specific options. And plot twist β€” cpp also accepts most gcc driver options, which are not listed here, so go check the GCC documentation for those. πŸ“š


πŸ’… DESCRIPTION πŸ’…

The C preprocessor β€” cpp to her friends β€” is a macro processor that the C compiler runs automatically to transform your program before compilation even happens. ✨

Why "macro processor"? Because she lets you define macros β€” cute little abbreviations for much longer constructs. That's the whole job. Slay.

Okay, real talk though: cpp is intended to be used only with C, C++, and Objective-C source code. In the past people abused her as a general text processor and honestly, she will choke on input that doesn't follow C's lexical rules. For example, apostrophes get interpreted as the beginning of character constants and cause errors. πŸ’€ Also, you can't rely on her preserving characteristics of the input that aren't significant to C-family languages. Case in point: if you preprocess a Makefile, all the hard tabs get removed, and then the Makefile does not work. Not the vibe.

Having said all that πŸ™ˆ β€” you can often get away with using cpp on things that aren't C. Other Algol-ish programming languages are usually safe (Ada, etc.). Assembly too, with caution. -traditional-cpp mode preserves more white space and is otherwise more permissive. And you can dodge a lot of the problems by writing C or C++ style comments instead of native language comments, and keeping your macros simple. ✨

Wherever possible, use a preprocessor that's actually geared to the language you're writing in. Periodt. Modern GNU assembler has its own macro facilities. Most high-level languages have their own conditional compilation and inclusion mechanisms. And if all else fails? Try a true general text processor, like GNU M4.

C preprocessors differ in some details. This manual is about the GNU C preprocessor, which provides a small superset of ISO Standard C's features. In her default mode, GNU CPP does not do a few things the standard requires β€” features that are rarely (if ever) used, and may cause surprising changes to the meaning of a program that doesn't expect them. 😭

Want strict ISO Standard C? Use -std=c90, -std=c99, -std=c11 or -std=c17 β€” pick whichever version of the standard you're after. And to get all the mandatory diagnostics, you also need -pedantic.

This manual describes the behavior of the ISO preprocessor. To keep gratuitous differences to a minimum, wherever the ISO preprocessor's behavior doesn't conflict with traditional semantics, the traditional preprocessor should behave the same way. The differences that do exist are detailed in the section Traditional Mode. 🧚

And for clarity: unless noted otherwise, every mention of CPP in this manual means GNU CPP. πŸ’œ


πŸ‘‘ OPTIONS πŸ‘‘

The cpp command expects two file names as arguments: infile and outfile. The preprocessor reads infile together with any other files it specifies via #include. All the output generated by the combined input files gets written to outfile. 🫢

Either infile or outfile may be -, which as infile means read from standard input, and as outfile means write to standard output. If either file is omitted, that's the same as if - had been given for it. You can also use the -o outfile option to name the output file. ✨

Unless otherwise noted, or the option ends in =, every option that takes an argument can have that argument either immediately after the option or with a space in between: -Ifoo and -I foo do the exact same thing. πŸ’…

⚠️ Many options have multi-letter names, therefore multiple single-letter options may not be grouped. -dM is very different from -d -M. Do not combine them, bestie, I'm begging.

  • -D name β€” Predefine name as a macro, with definition 1. πŸŽ€
  • -D name=definition β€” The contents of definition are tokenized and processed as if they appeared during translation phase three in a #define directive. In particular, the definition is truncated by embedded newline characters.

If you're invoking the preprocessor from a shell or shell-like program, you may need to use the shell's quoting syntax to protect characters like spaces that mean something to the shell. 😭

Want to define a function-like macro on the command line? Write its argument list with surrounding parentheses before the equals sign (if any). Parentheses are meaningful to most shells, so quote the option. With sh and csh, -D'name(args...)=definition' works. ✨

-D and -U options are processed in the order they are given on the command line. All -imacros file and -include file options are processed after all -D and -U options.

  • -U name β€” Cancel any previous definition of name, whether it's built in or came from a -D option. πŸ’…
  • -include file β€” Process file as if #include "file" appeared as the first line of the primary source file. But β€” plot twist β€” the first directory searched for file is the preprocessor's working directory instead of the directory containing the main source file. If it's not found there, it's searched for in the remainder of the #include "..." search chain as normal. πŸ¦‹

If multiple -include options are given, the files are included in the order they appear on the command line.

  • -imacros file β€” Exactly like -include, except any output produced by scanning file is thrown away. Macros it defines stay defined. This lets you grab all the macros from a header without also processing its declarations. πŸ‘‘

All files specified by -imacros are processed before all files specified by -include.

  • -undef β€” Do not predefine any system-specific or GCC-specific macros. The standard predefined macros remain defined. 🌈
  • -pthread β€” Define additional macros required for using the POSIX threads library. Use this option consistently for both compilation and linking. Supported on GNU/Linux targets, most other Unix derivatives, and also on x86 Cygwin and MinGW targets. 🧡✨
  • -M β€” Instead of outputting the result of preprocessing, output a rule suitable for make describing the dependencies of the main source file. The preprocessor outputs one make rule containing the object file name for that source file, a colon, and the names of all the included files β€” including those coming from -include or -imacros command-line options.

Unless specified explicitly (with -MT or -MQ), the object file name is the name of the source file with any suffix replaced with the object file suffix, and with any leading directory parts removed. If there are many included files, the rule is split into several lines using \-newline. The rule has no commands. πŸ’€

This option does not suppress the preprocessor's debug output, such as -dM. To avoid mixing that debug output with the dependency rules, explicitly specify the dependency output file with -MF, or use an environment variable like DEPENDENCIES_OUTPUT. Debug output is still sent to the regular output stream as normal.

Passing -M to the driver implies -E, and suppresses warnings with an implicit -w.

  • -MM β€” Like -M, but do not mention header files found in system header directories, nor header files included β€” directly or indirectly β€” from such a header.

This means the choice of angle brackets or double quotes in an #include directive does not by itself determine whether that header appears in -MM dependency output. πŸ€”

  • -MF file β€” When used with -M or -MM, specifies a file to write the dependencies to. If no -MF switch is given, the preprocessor sends the rules to the same place it would send preprocessed output.

When used with the driver options -MD or -MMD, -MF overrides the default dependency output file.

If file is -, then the dependencies are written to stdout. ✨

  • -MG β€” In conjunction with an option such as -M requesting dependency generation, -MG assumes missing header files are generated files and adds them to the dependency list without raising an error. The dependency filename is taken directly from the #include directive without prepending any path. -MG also suppresses preprocessed output, since a missing header file renders that useless. πŸ™ˆ

This feature is used in automatic updating of makefiles.

  • -Mno-modules β€” Disable dependency generation for compiled module interfaces. πŸ”‡
  • -MP β€” This option instructs CPP to add a phony target for each dependency other than the main file, causing each to depend on nothing. These dummy rules work around the errors make gives if you remove header files without updating the Makefile to match. πŸ‘‘

This is typical output:

test.o: test.c test.h

test.h:
  • -MT target β€” Change the target of the rule emitted by dependency generation. By default, CPP takes the name of the main input file, deletes any directory components and any file suffix such as .c, and appends the platform's usual object suffix. That result is the target. πŸ’…

An -MT option sets the target to be exactly the string you specify. Want multiple targets? Specify them as a single argument to -MT, or use multiple -MT options.

For example, -MT '$(objpfx)foo.o' might give

$(objpfx)foo.o: foo.c
  • -MQ target β€” Same as -MT, but it quotes any characters which are special to Make. -MQ '$(objpfx)foo.o' gives
$$(objpfx)foo.o: foo.c

The default target is automatically quoted, as if it were given with -MQ. ✨

  • -MD β€” -MD is equivalent to -M -MF file, except that -E is not implied. The driver determines file based on whether an -o option is given. If it is, the driver uses its argument but with a suffix of .d; otherwise it takes the name of the input file, removes any directory components and suffix, and applies a .d suffix. πŸŽ€

If -MD is used in conjunction with -E, any -o switch is understood to specify the dependency output file β€” but if used without -E, each -o is understood to specify a target object file. Don't mix those up bestie, it's giving chaos. πŸ’€

Since -E is not implied, -MD can be used to generate a dependency output file as a side effect of the compilation process. 🌸


and that's part one bestie!! there's more coming β€” don't go anywhere πŸ’–

  • -MMD β€” literally -MD but the shy version πŸ’… it only name-drops user header files, no system headers invited to the party.
  • -fpreprocessed β€” bestie, this one tells the preprocessor "girl, this file's already been preprocessed, chill." ✨ So it skips the fun stuff: no macro expansion, no trigraph conversion, no escaped newline splicing, and most directives just get ignored. BUT β€” and this is the cute part β€” it still spots and deletes comments, so you can hand it a file that was preprocessed with -C and compile it no problem 🫢. In this mode the integrated preprocessor is basically just a tokenizer for the front ends. Lowkey minimal.

-fpreprocessed is implicit (i.e. auto-on, no asking) if your input file ends in .i, .ii, or .mi πŸ‘‘. Those are exactly the extensions GCC uses for preprocessed files it made with -save-temps.

  • -fdirectives-only β€” when preprocessing, handle the directives but do NOT expand macros, periodt. βœ‹

Its whole vibe depends on -E and -fpreprocessed:

  • With -E, preprocessing is limited to handling directives like "#define", "#ifdef", and "#error". Everything else β€” macro expansion, trigraph conversion β€” nope, not happening πŸ™ˆ. Also -dD gets implicitly enabled in this mode.
  • With -fpreprocessed, predefinition of command line and most builtin macros is disabled. Contextually dependent ones like "__LINE__" still work like normal though πŸ’œ. This lets you compile files that were previously preprocessed with "-E -fdirectives-only".
  • With both -E and -fpreprocessed? The -fpreprocessed rules win, bestie β€” they take precedence. That gives you full preprocessing of files that were previously preprocessed with "-E -fdirectives-only". Slay πŸ”₯
  • -fdollars-in-identifiers β€” accept $ in identifiers. That's it. That's the whole thing πŸ’…
  • -fextended-identifiers β€” accept universal character names AND extended characters in identifiers 🌈. Enabled by default for C99 (and later C standard versions) and C++.
  • -fno-canonical-system-headers β€” when preprocessing, don't shorten system header paths with canonicalization. Leave 'em long, leave 'em proud πŸ’
  • -fmax-include-depth=depth β€” sets the maximum depth of nested #include. Default is 200. Don't go deeper than that, babe πŸŒ€
  • -ftabstop=width β€” sets the distance between tab stops. This is so the preprocessor can report the correct column numbers in warnings or errors even when tabs are sitting on the line πŸ“. If the value is less than 1 or greater than 100, the option is just ignored (rude, but okay). Default is 8.
  • -ftrack-macro-expansion[=level] β€” tracks token locations across macro expansions ✨. This lets the compiler spill the tea about the current macro expansion stack when a compilation error happens inside a macro expansion. Heads up: using this makes the preprocessor and the compiler eat more memory 😭. The level parameter picks how precise the token location tracking is, so you can dial down memory use if you need to:
    • 0 de-activates the option entirely.
    • 1 tracks token locations in a degraded mode for minimal memory overhead β€” in this mode, all tokens resulting from expanding an argument of a function-like macro get the same location.
    • 2 tracks token locations completely πŸ’― and is the most memory hungry.

Give the option no argument and the default parameter value is 2.

Ngl, "-ftrack-macro-expansion=2" is activated by default πŸ‘‘
  • -fmacro-prefix-map=old=new β€” when preprocessing files that live in directory old, expand the "__FILE__" and "__BASE_FILE__" macros as if those files lived in directory new instead πŸͺ„. You can use this to turn an absolute path into a relative one by setting new to ., which gives you more reproducible builds that don't care where they're located. This option also affects "__builtin_FILE()" during compilation. Also see -ffile-prefix-map and -fcanon-prefix-map πŸ‘€
  • -fexec-charset=charset β€” sets the execution character set, used for string and character constants. Default is UTF-8 πŸ’–. charset can be any encoding supported by the system's "iconv" library routine.
  • -fwide-exec-charset=charset β€” sets the wide execution character set, used for wide string and character constants 🌸. The default is one of UTF-32BE, UTF-32LE, UTF-16BE, or UTF-16LE β€” whichever matches the width of "wchar_t" and whether big-endian or little-endian byte order is being used for code generation. Same deal as -fexec-charset: charset can be any encoding supported by the system's "iconv" library routine. HOWEVER 😬 β€” you will have problems with encodings that don't fit exactly in "wchar_t".
  • -finput-charset=charset β€” sets the input character set, used for translating from the input file's character set to the source character set GCC uses πŸ¦‹. If the locale doesn't specify it, or GCC can't get that info from the locale, the default is UTF-8. This can be overridden by either the locale or this command-line option β€” and currently the command-line option wins if there's a conflict πŸ‘‘. charset can be any encoding supported by the system's "iconv" library routine.
  • -fworking-directory β€” enables generation of linemarkers in the preprocessor output that let the compiler know the current working directory at the time of preprocessing πŸ“‚. When on, the preprocessor emits, right after the initial linemarker, a second linemarker with the current working directory followed by two slashes. GCC uses that directory (when it's present in the preprocessed input) as the directory emitted as the current working directory in some debugging information formats. This is implicitly enabled if debugging information is enabled, but you can shut it down with the negated form -fno-working-directory. And if -P is on the command line, this option has no effect β€” because no "#line" directives get emitted whatsoever, so like… there's nothing to work with πŸ’€.
  • -A predicate=answer β€” make an assertion with the predicate predicate and answer answer ✍️. This form is preferred over the older form -A predicate(answer), which is still supported, because it doesn't use shell special characters. (Shell-hostile syntax is so not the vibe.)
  • -A -predicate=answer β€” cancel an assertion with the predicate predicate and answer answer. Bye bye assertion πŸ’…
  • -C β€” do not discard comments πŸ™…β™€οΈ. All comments get passed through to the output file, EXCEPT comments in processed directives, which get deleted along with the directive.
Be prepared for side effects when you use -C, bestie β€” it makes the preprocessor treat comments as tokens in their own right. For example, comments sitting at the start of what would be a directive line turn that line into an ordinary source line, because the first token on the line is no longer a # 😭
  • -CC β€” do not discard comments, including during macro expansion ✨. This is like -C, except comments inside macros also get passed through to the output file wherever the macro is expanded.

On top of the side effects of -C, -CC also converts all C++-style comments inside a macro into C-style comments. Why? To stop later use of that macro from inadvertently commenting out the rest of the source line πŸ™ˆ. This option is generally used to support lint comments.

  • -P β€” inhibit generation of linemarkers in the preprocessor output 🚫. Handy when you're running the preprocessor on something that isn't C code and it's headed to a program that would be confused by linemarkers.
  • -traditional
  • -traditional-cpp β€” try to imitate the behavior of pre-standard C preprocessors, as opposed to ISO C preprocessors πŸ¦•. Note that GCC doesn't otherwise attempt to emulate a pre-standard C compiler, and these options are only supported with the -E switch, or when invoking CPP explicitly.
  • -trigraphs β€” support ISO C trigraphs 🌈. These are three-character sequences, all starting with ??, that ISO C defines to stand for single characters. For example, ??/ stands for \, so '??/n' is a character constant for a newline. By default GCC ignores trigraphs, but in standard-conforming modes it converts them. See the -std and -ansi options πŸ‘‘
  • -remap β€” enables special code to work around file systems that only permit very short file names, like MS-DOS πŸ’Ύ. Throwback.
  • -H β€” print the name of each header file used, in addition to all the other normal activities πŸ“‹. Each name is indented to show how deep in the #include stack it is. Precompiled header files get printed too, even if they turn out to be invalid β€” an invalid precompiled header file prints with ...x and a valid one prints with ...! πŸ‘€
  • -dletters β€” says to make debugging dumps during compilation as specified by letters πŸ”€. The flags documented here are the ones relevant to the preprocessor. Other letters get interpreted by the compiler proper, or reserved for future versions of GCC, so they're silently ignored 🀐. And if you specify letters whose behavior conflicts? The result is undefined. Don't do that.
    • -dM β€” instead of the normal output, generate a list of #define directives for all the macros defined during the preprocessor's execution, including predefined macros ✨. This is your way of finding out what's predefined in your version of the preprocessor. Assuming you have no file foo.h, this command:
touch foo.h; cpp -dM foo.h

shows all the predefined macros πŸ‘‘

  • -dD β€” like -dM except in two respects: it doesn't include the predefined macros, and it outputs both the #define directives and the result of preprocessing. Both kinds of output go to the standard output file πŸ’…
  • -dN β€” like -dD, but emit only the macro names, not their expansions βœ‚οΈ
  • -dI β€” output #include directives in addition to the result of preprocessing πŸ“Ž
  • -dU β€” like -dD except that only macros that are expanded, or whose definedness is tested in preprocessor directives, are output. The output is delayed until the macro's actual use or test πŸ•°οΈ. And #undef directives are also output for macros that were tested but undefined at the time.
  • -fdebug-cpp β€” this one is only useful for debugging GCC πŸ›. When used from CPP or with -E, it dumps debugging information about location maps. Every token in the output gets preceded by the dump of the map its location belongs to. When used from GCC without -E, this option has no effect whatsoever ✨

🌸 okay that's a whole lot of preprocessor lore, but bestie we are SO not done yet… more incoming πŸ’–

  • -I dir, -iquote dir, -isystem dir, -idirafter dir β€” bestie, these four are the "where do I look for headers" girls πŸ’– each one adds dir to the list of directories that get searched for header files during preprocessing.

Okay so fun detail: if dir starts with = or $SYSROOT, then that = or $SYSROOT gets replaced by the sysroot prefix. See --sysroot and -isysroot for the lore. 🫢

And there's a little hierarchy here, pay attention:

  • Dirs you give with -iquote apply only to the quote form of the directive, #include "file". Exclusive behavior, we love. ✨
  • Dirs you give with -I, -isystem, or -idirafter apply to lookup for both #include "file" and #include <file>.

You can stack any number or any combo of these on the command line to search several directories for headers. The lookup order is, in this exact order:

  1. For the quote form of the include directive, the directory of the current file is searched first.
  2. For the quote form of the include directive, the directories specified by -iquote options are searched in left-to-right order, as they appear on the command line.
  3. Directories specified with -I options are scanned in left-to-right order.
  4. Directories specified with -isystem options are scanned in left-to-right order.
  5. Standard system directories are scanned.
  6. Directories specified with -idirafter options are scanned in left-to-right order.

You can use -I to override a system header file, swapping in your own version, because these directories get searched before the standard system header file directories. Main character move, honestly πŸ‘‘ BUT β€” do not use this option to add directories that hold vendor-supplied system header files. Use -isystem for that, okay? Not negotiable.

The -isystem and -idirafter options also mark the directory as a system directory, so it gets the exact same special treatment that's applied to the standard system directories. Same energy, no cap. 🌈

Now the spicy bit: if a standard system include directory, or a directory specified with -isystem, is also specified with -I, the -I option is ignored. πŸ’€ The directory is still searched β€” but as a system directory, at its normal position in the system include chain. Why?? Because this is to ensure that GCC's procedure to fix buggy system headers, and the ordering for the #include_next directive, are not inadvertently changed. If you really need to change the search order for system directories, use the -nostdinc and/or -isystem options instead. iykyk.

  • -I- β€” split the include path. πŸͺ“ > Heads up bestie: this option has been deprecated. Please use -iquote instead for -I directories before the -I-, and just remove the -I- option entirely. It's giving legacy.

For the record on what it did: any directories specified with -I options before -I- are searched only for headers requested with #include "file"; they are not searched for #include <file>. If additional directories are specified with -I options after the -I-, those directories are searched for all #include directives.

Also: -I- inhibits the use of the directory of the current file directory as the first search directory for #include "file". And there is no way to override this effect of -I-. None. It's over. 😭

  • -iprefix prefix β€” sets prefix as the prefix for all the subsequent -iwithprefix options. If the prefix represents a directory, you should include the final /. Don't forget it, the slashes matter bestie πŸŽ€
  • -iwithprefix dir, -iwithprefixbefore dir β€” append dir to the prefix you specified earlier with -iprefix, and add the resulting directory to the include search path. Placement tea β˜•: -iwithprefixbefore puts it in the same place -I would; -iwithprefix puts it where -idirafter would.
  • -isysroot dir β€” this is like the --sysroot option but applies only to header files. (Exception: Darwin targets, where it applies to both header files and libraries. Special case behavior, iconic of them.) See the --sysroot option for more info.
  • -imultilib dir β€” use dir as a subdirectory of the directory containing target-specific C++ headers. Very specific, very niche, but she's in the manual so she's here πŸ’…
  • -nostdinc β€” do not search the standard system directories for header files. Only the directories explicitly specified with -I, -iquote, -isystem, and/or -idirafter options get searched (plus the directory of the current file, if appropriate). Choose your own adventure mode. ✨
  • -nostdinc++ β€” don't search for header files in the C++-specific standard directories, but do still search the other standard directories. (This option is used when building the C++ library.) Super targeted.

  • -Wcomment, -Wcomments β€” warn whenever a comment-start sequence /* appears in a /* comment, or whenever a backslash-newline appears in a // comment. This warning is enabled by -Wall.
  • -Wtrigraphs β€” warn if any trigraphs are encountered that might change the meaning of the program. Trigraphs within comments are not warned about, except those that would form escaped newlines. 😌

This option is implied by -Wall. If -Wall isn't given, this option is still enabled β€” unless trigraphs are enabled. And if you want trigraph conversion without warnings, but still want the other -Wall warnings, use -trigraphs -Wall -Wno-trigraphs. Combo move, slay. πŸ”₯

  • -Wundef β€” warn if an undefined identifier is evaluated in an #if directive. Such identifiers are replaced with zero. That's the vibe: unknown = zero.
  • -Wexpansion-to-defined β€” warn whenever defined is encountered in the expansion of a macro (including the case where the macro is expanded by an #if directive). Such usage is not portable. 🚩 This warning is also enabled by -Wpedantic and -Wextra.
  • -Wunused-macros β€” warn about macros defined in the main file that are unused. A macro counts as used if it is expanded, or tested for existence, at least once. The preprocessor also warns if the macro has not been used at the time it is redefined or undefined.

Not warned about: built-in macros, macros defined on the command line, and macros defined in include files. They're exempt, bestie, they have immunity. πŸ™ˆ

Note: if a macro is actually used, but only used in skipped conditional blocks, the preprocessor reports it as unused. To dodge the warning in that case, you might improve the scope of the macro's definition by, for example, moving it into the first skipped block. Alternatively, you could provide a dummy use with something like:
#if defined the_macro_causing_the_warning
#endif
  • -Wno-endif-labels β€” do not warn whenever an #else or an #endif is followed by text. This sometimes happens in older programs with code of the form:
#if FOO
...
#else FOO
...
#endif FOO

The second and third FOO should be in comments. 😭 This warning is on by default.


🌱 ENVIRONMENT 🌱

This section is all about the environment variables that affect how CPP operates. You can use them to specify directories or prefixes to use when searching for include files, or to control dependency output. Environment variable girlies, this one's for you πŸ’œ

Note that you can also specify places to search using options such as -I, and control dependency output with options like -M. Those take precedence over environment variables, which in turn take precedence over the configuration of GCC. Precedence chain, get it right: options > env vars > GCC's config. Periodt.

πŸ¦‹ CPATH

πŸ¦‹ C_INCLUDE_PATH

πŸ¦‹ CPLUS_INCLUDE_PATH

πŸ¦‹ OBJC_INCLUDE_PATH

Each variable's value is a list of directories separated by a special character, much like PATH, in which to look for header files. The special character, PATH_SEPARATOR, is target-dependent and determined at GCC build time. For Microsoft Windows-based targets it is a semicolon, and for almost all other targets it is a colon. (So usually : β€” but check your target, bestie πŸŽ€)

CPATH specifies a list of directories to be searched as if specified with -I, but after any paths given with -I options on the command line. This environment variable is used regardless of which language is being preprocessed. Universal, she doesn't pick favorites. ✨

The remaining environment variables apply only when preprocessing the particular language indicated. Each specifies a list of directories to be searched as if specified with -isystem, but after any paths given with -isystem options on the command line.

In all these variables, an empty element instructs the compiler to search its current working directory. Empty elements can appear at the beginning or end of a path. For instance, if the value of CPATH is :/special/include, that has the same effect as -I. -I/special/include. Sneaky little empty element, we love her. πŸ’…

🌸 DEPENDENCIES_OUTPUT

If this variable is set, its value specifies how to output dependencies for Make based on the non-system header files processed by the compiler. System header files are ignored in the dependency output. Not invited to the party. 🚫

The value of DEPENDENCIES_OUTPUT can be just a file name, in which case the Make rules are written to that file, guessing the target name from the source file name. Or the value can have the form file target, in which case the rules are written to file file using target as the target name.

In other words, this environment variable is equivalent to combining the options -MM and -MF, with an optional -MT switch too. Two-for-one deal, obsessed. 🫢

πŸ“ SUNPRO_DEPENDENCIES

This variable is the same as DEPENDENCIES_OUTPUT (see above), except that system header files are not ignored, so it implies -M rather than -MM. However, the dependence on the main input file is omitted. Different flavor, same energy.

⭐ SOURCE_DATE_EPOCH

If this variable is set, its value specifies a UNIX timestamp to be used in replacement of the current date and time in the __DATE__ and __TIME__ macros, so that the embedded timestamps become reproducible. Reproducible builds stans, rise πŸ™Œ

The value of SOURCE_DATE_EPOCH must be a UNIX timestamp, defined as the number of seconds (excluding leap seconds) since 01 Jan 1970 00:00:00 represented in ASCII; identical to the output of date +%s on GNU/Linux and other systems that support the %s extension in the date command.

The value should be a known timestamp such as the last modification time of the source or package, and it should be set by the build process. Don't make it up, bestie β€” let the build process handle it. πŸ’–


πŸ’« SEE ALSO πŸ’«

gpl(7), gfdl(7), fsf-funding(7), gcc(1), and the Info entries for cpp and gcc.

Like, go read those too, they're part of the cinematic universe. 🌈

okay bestie, legal era, we're doing it β€” stay with me, this part is short but it's iconic and it's literally what makes all of this shareable in the first place:

Copyright (c) 1987-2023 Free Software Foundation, Inc.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation. A copy of the license is included in the man page gfdl(7). This manual contains no Invariant Sections. The Front-Cover Texts are (a) (see below), and the Back-Cover Texts are (b) (see below). ✨


πŸŽ€ (a) the Front-Cover Text, bestie

The FSF's Front-Cover Text is:

A GNU Manual

πŸ¦‹ (b) the Back-Cover Text, no cap

The FSF's Back-Cover Text is:

You have freedom to copy and modify this GNU Manual, like GNU
software.  Copies published by the Free Software Foundation raise
funds for GNU development.

fr fr β€” that's the whole thing. You now know cpp better than like 90% of people who claim they know cpp. ate and left no crumbs. πŸ’…

And a lil' sign-off because you deserve it: this page ships as gcc-13, dated 2026-09-10 β€” yeah, it's literally from the future, main character energy only 🌈⭐. Go compile something beautiful, bestie πŸ«ΆπŸ’–