CPP(1)

๐Ÿ“ฆ
version 10.5.0 ยท 3 versions
, in ubuntu jammy

Okay bestie, welcome to the manual for cpp, section 1, GNU edition ๐ŸŽ€ Part 1 of 3, so 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]

Only the most useful options are up top, so scroll for the full list of preprocessor-specific options ๐Ÿ‘€ cpp also takes most gcc driver options, which aren't listed here. For those, check the GCC documentation ๐Ÿ“š

โœจ DESCRIPTION โœจ

The C preprocessor, aka cpp, is a macro processor that the C compiler uses automatically to transform your program before compilation ๐Ÿงš It's called a macro processor because it lets you define macros, which are brief abbreviations for longer constructs โœจ

The C preprocessor is meant to be used only with C, C++, and Objective-C source code ๐Ÿ’… People have abused it as a general text processor in the past ๐Ÿ’€, and it will choke on input that doesn't follow C's lexical rules. Apostrophes, for example, get read as the start of character constants and cause errors ๐Ÿ™ˆ You also can't rely on it keeping characteristics of the input that don't matter to C-family languages. If a Makefile gets preprocessed, all the hard tabs get removed and the Makefile won't work ๐Ÿ˜ญ

Warning, bestie: preprocess a Makefile and all the hard tabs disappear, so it won't work. Not it. ๐Ÿ’€

Having said that, you can often get away with using cpp on things that aren't C ๐Ÿฆ‹ Other Algol-ish languages are often safe (Ada, etc.). Assembly is also okay, but with caution. -traditional-cpp mode preserves more white space and is otherwise more permissive. Lots of the problems can be avoided by writing C or C++ style comments instead of native language comments, and by keeping macros simple ๐ŸŒธ

Wherever possible, use a preprocessor geared to the language you're writing in ๐Ÿ‘‘ Modern versions of the GNU assembler have macro facilities. Most high-level programming languages have their own conditional compilation and inclusion mechanisms. If all else fails, try a true general text processor, like GNU M4 ๐Ÿซถ

C preprocessors vary in some details โœจ This manual is about the GNU C preprocessor, which provides a small superset of the features of ISO Standard C. In its default mode, the GNU C preprocessor skips a few things the standard requires. These are features that are rarely, if ever, used, and skipping them can cause surprising changes to the meaning of a program that doesn't expect them ๐Ÿ™ˆ To get strict ISO Standard C, use -std=c90, -std=c99, -std=c11 or -std=c17, depending on which version of the standard you want. To get all the mandatory diagnostics, you must also use -pedantic ๐Ÿ’œ

This manual describes the behavior of the ISO preprocessor. To minimize gratuitous differences, where the ISO preprocessor's behavior doesn't conflict with traditional semantics, the traditional preprocessor should behave the same way. The various differences that do exist are detailed in the section Traditional Mode ๐Ÿ“

For clarity, unless noted otherwise, references to CPP in this manual refer to 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 with #include. All the output generated by the combined input files is written in outfile โœจ

Either infile or outfile may be -. As infile, it means read from standard input, and as outfile, it means write to standard output ๐ŸŽ€ If either file is omitted, it means the same as if - had been specified for that file. You can also use the -o outfile option to specify the output file ๐Ÿ’…

Unless otherwise noted, or the option ends in =, all options which take an argument may have that argument appear either immediately after the option, or with a space between option and argument. -Ifoo and -I foo have the same effect ๐Ÿฆ‹

Many options have multi-letter names, so multiple single-letter options can't be grouped. -dM is very different from -d -M ๐Ÿ’€

  • -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 gets truncated by embedded newline characters. If you're invoking the preprocessor from a shell or shell-like program, you may need the shell's quoting syntax to protect characters like spaces that have a meaning in shell syntax. If you 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 ๐Ÿง 

Heads up, these ordering rules matter! -D and -U options are processed in the order they're 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, either built in or provided with a -D option ๐Ÿงน
  • -include file โ€” Process file as if #include "file" appeared as the first line of the primary source file. However, 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 that any output produced by scanning file is thrown away. Macros it defines remain defined. This lets you acquire 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 โ€” Don't 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. You should use this option consistently for both compilation and linking ๐Ÿงต It's 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 consists of 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 don't mention header files that are found in system header directories, nor header files that are included, directly or indirectly, from such a header. This implies that the choice of angle brackets or double quotes in an #include directive doesn't in 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, as a missing header file renders this useless. This feature is used in automatic updating of makefiles ๐Ÿ› ๏ธ
  • -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 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:

(part 1 of 3, more on the way ๐Ÿ’œ)

  • -fpreprocessed โ€” okay so this one tells the preprocessor "hey bestie, this file is already preprocessed, don't redo the work" ๐Ÿ’… That means macro expansion, trigraph conversion, escaped newline splicing, and most directive processing get skipped โœจ The preprocessor still recognizes and removes comments, so you can pass it a file preprocessed with -C and it'll be totally fine ๐Ÿซถ In this mode the integrated preprocessor is little more than a tokenizer for the front ends ๐Ÿงš Also, -fpreprocessed is implicit if the input file ends in .i, .ii or .mi. Those are the extensions GCC uses for preprocessed files made by -save-temps ๐ŸŒธ
  • -fdirectives-only โ€” when preprocessing, handle directives but do NOT expand macros ๐Ÿฆ‹ How it acts depends on -E and -fpreprocessed, so let's break it down:
    • With -E, it only handles directives like #define, #ifdef, and #error ๐Ÿ’– Other stuff like macro expansion and trigraph conversion doesn't happen. The -dD option also gets turned on automatically โœจ
    • With -fpreprocessed, predefining command line macros and most builtin macros is turned off ๐Ÿ™ˆ Context-dependent macros like __LINE__ are still handled normally. This lets you compile files that were previously preprocessed with -E -fdirectives-only ๐Ÿ‘‘
    • With both -E and -fpreprocessed, the -fpreprocessed rules win ๐Ÿ’… That gives you full preprocessing of files previously preprocessed with -E -fdirectives-only ๐Ÿ”ฅ
  • -fdollars-in-identifiers โ€” lets $ be used inside identifiers ๐Ÿ’ฒ
  • -fextended-identifiers โ€” accepts universal character names and extended characters in identifiers ๐ŸŒˆ This one is 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 ๐Ÿ™…โ€โ™€๏ธ
  • -fmax-include-depth=depth โ€” sets the maximum depth of nested #includes. The default is 200 ๐Ÿงš
  • -ftabstop=width โ€” sets the distance between tab stops โญ This helps the preprocessor report correct column numbers in warnings or errors, even when tabs show up on the line ๐ŸŽ€ If the value is less than 1 or greater than 100, the option gets ignored. The default is 8 ๐Ÿ“
  • -ftrack-macro-expansion[=level] โ€” tracks token locations across macro expansions ๐Ÿ” This lets the compiler show the current macro expansion stack when an error happens inside a macro expansion. Heads up though: using it makes the preprocessor and the compiler eat more memory ๐Ÿ’€ The level parameter picks how precise the location tracking is, so you can drop memory use if you need to:
    • Level 0 de-activates this option.
    • Level 1 tracks token locations in a degraded mode to keep memory overhead minimal. In this mode, every token from expanding an argument of a function-like macro has the same location.
    • Level 2 tracks token locations completely. It's the most memory hungry option ๐Ÿ˜

If you give the option no argument at all, the default level is 2 ๐Ÿซถ Also note that -ftrack-macro-expansion=2 is activated by default โœจ

  • -fmacro-prefix-map=old=new โ€” when preprocessing files living in directory old, expands __FILE__ and __BASE_FILE__ as if those files were in directory new instead ๐Ÿ—บ๏ธ You can use this to swap an absolute path for a relative one by putting . in for new, which can lead to more reproducible builds that don't depend on location ๐ŸŒฟ This option also affects __builtin_FILE() during compilation. See also -ffile-prefix-map.
  • -fexec-charset=charset โ€” sets the execution character set, used for string and character constants ๐Ÿ’Œ The 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 the big-endian or little-endian byte order used for code generation ๐Ÿฆ‹ Same as with -fexec-charset, charset can be any encoding supported by the system's iconv library routine. Warning: you'll 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 into the source character set GCC uses ๐Ÿ“œ If the locale doesn't say, or GCC can't get the info from the locale, the default is UTF-8. The locale or this command-line option can override it, and if they conflict, the command-line option wins for now ๐Ÿ‘‘ charset can be any encoding supported by the system's iconv library routine ๐Ÿซง
  • -fworking-directory โ€” turns on linemarkers in the preprocessor output so the compiler knows the working directory at preprocessing time ๐Ÿ—‚๏ธ When it's on, the preprocessor emits a second linemarker after the initial one, with the current working directory followed by two slashes ๐Ÿงญ GCC uses that directory, when it's in the preprocessed input, as the working directory in some debugging information formats ๐Ÿž This is implicitly enabled when debugging info is enabled, but you can block it with the negated form -fno-working-directory ๐Ÿ™…โ€โ™€๏ธ If the -P flag is in the command line, this option does nothing, because no #line directives get emitted whatsoever ๐Ÿ’€
  • -A predicate=answer โ€” makes an assertion with the predicate predicate and the answer answer ๐ŸŽ€ This form is preferred over the older -A predicate(answer) form. The old one still works, but this one doesn't use shell special characters, so it's way less messy โœจ
  • -A -predicate=answer โ€” cancels an assertion with the predicate predicate and the answer answer ๐Ÿšซ
  • -C โ€” do NOT discard comments ๐Ÿ’ฌ All comments get passed through to the output file, except for comments inside processed directives, which get deleted along with the directive ๐Ÿ—‘๏ธ Heads up: you should be ready for side effects with -C. It makes the preprocessor treat comments as tokens in their own right ๐Ÿง For example, a comment at the start of what would be a directive line turns that line into an ordinary source line, since the first token on the line is no longer a # ๐Ÿ˜ณ
  • -CC โ€” do NOT discard comments, even during macro expansion ๐Ÿซถ It's like -C, except comments inside macros also get passed through to the output file wherever the macro gets expanded ๐ŸŒˆ On top of the -C side effects, -CC converts all C++-style comments inside a macro into C-style comments ๐Ÿ›ก๏ธ That's to stop a later use of the macro from accidentally commenting out the rest of the source line ๐Ÿ™ˆ -CC is generally used to support lint comments ๐Ÿ”
  • -P โ€” inhibits the generation of linemarkers in the preprocessor output ๐Ÿšซ๐Ÿ“ This might be useful when you run the preprocessor on something that isn't C code and send it to a program that could get confused by linemarkers ๐Ÿงฉ
  • -traditional, -traditional-cpp โ€” tries to imitate the behavior of pre-standard C preprocessors instead of ISO C preprocessors ๐Ÿ•ฐ๏ธ Note: GCC doesn't otherwise try to emulate a pre-standard C compiler, and these options are only supported with the -E switch or when invoking CPP explicitly ๐ŸŽฉ
  • -trigraphs โ€” supports ISO C trigraphs ๐Ÿ”บ These are three-character sequences that all start with ??, which 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 allow super short file names, like MS-DOS ๐Ÿ’พ
  • -H โ€” prints the name of each header file used, on top of the other normal stuff ๐Ÿ“‹ Each name is indented to show how deep it is in the #include stack ๐Ÿชœ Precompiled header files get printed too, even if they turn out to be invalid. An invalid precompiled header gets printed with ...x, and a valid one with ...! โœ…โŒ
  • -dletters โ€” makes debugging dumps during compilation, as specified by letters ๐Ÿงช The flags documented here are the ones relevant to the preprocessor. Other letters are interpreted by the compiler proper, or reserved for future versions of GCC, so they're silently ignored ๐Ÿคซ Careful: if you specify letters whose behavior conflicts, the result is undefined ๐Ÿ’€
    • -dM โ€” instead of the normal output, generates a list of #define directives for all the macros defined during the execution of the preprocessor, including predefined macros ๐Ÿ“œ This is a way to find out what's predefined in your version of the preprocessor ๐Ÿ”Ž Assuming you have no file foo.h, you can run this to see all the predefined macros:
touch foo.h; cpp -dM foo.h
  • -dD โ€” like -dM, except it does NOT 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 only emits the macro names, not their expansions ๐Ÿท๏ธ
  • -dI โ€” outputs #include directives in addition to the result of preprocessing ๐Ÿ“ฅ
  • -dU โ€” like -dD, except only macros that are expanded, or whose definedness is tested in preprocessor directives, get output ๐ŸŽฏ The output is delayed until the use or test of the macro, and #undef directives are also output for macros that were tested but were undefined at the time ๐Ÿง 
  • -fdebug-cpp โ€” only useful for debugging GCC ๐Ÿ› When used from CPP or with -E, it dumps debugging info about location maps. Every token in the output is preceded by the dump of the map its location belongs to ๐Ÿ—บ๏ธ When used from GCC without -E, this option has no effect ๐Ÿ™ƒ
  • -I dir, -iquote dir, -isystem dir, -idirafter dir โ€” adds the directory dir to the list of directories searched for header files during preprocessing ๐Ÿ“‚โœจ

If dir starts with = or $SYSROOT ๐ŸŒธ, that part gets swapped out for the sysroot prefix โœจ. Check out --sysroot and -isysroot for the deets ๐Ÿ’….

Directories you give with -iquote only count for the quote form, #include "file" ๐ŸŽ€. Directories from -I, -isystem, or -idirafter work for both #include "file" and #include <file> ๐Ÿซถ.

You can stack as many of these as you want on the command line to search a bunch of folders ๐Ÿฆ‹. The lookup order goes like this:

  1. For the quote form, the folder of the current file gets checked first ๐Ÿ’–.
  2. For the quote form, -iquote folders get searched left-to-right, in the order you typed them ๐ŸŒˆ.
  3. -I folders get scanned left-to-right ๐Ÿงš.
  4. -isystem folders get scanned left-to-right ๐Ÿ‘‘.
  5. Standard system directories get scanned ๐Ÿ’….
  6. -idirafter folders get scanned left-to-right ๐Ÿ“.

You can use -I to override a system header file and swap in your own version, since those folders get searched before the standard system header directories ๐Ÿ”ฅ. But bestie, don't use this to add folders with vendor-supplied system headers. Use -isystem for that ๐Ÿ’€.

The -isystem and -idirafter options also mark the directory as a system directory, so it gets the same special treatment as the standard system directories ๐Ÿฆ‹.

If a standard system include directory, or a directory given with -isystem, also shows up with -I, the -I option gets ignored ๐Ÿ™ˆ. The directory still gets searched, but as a system directory at its normal spot in the system include chain. This is so GCC's procedure to fix buggy system headers and the ordering for the #include_next directive don't get accidentally changed ๐Ÿซถ. If you really need to change the search order for system directories, use the -nostdinc and/or -isystem options ๐Ÿ’œ.

  • -I- โ€” Splits the include path. This one is deprecated ๐Ÿ˜ญ, so please use -iquote instead for -I directories before the -I-, and remove the -I- option. Any -I directories before -I- only get searched for headers requested with #include "file". They are NOT searched for #include <file>. If extra -I directories show up after the -I-, those get searched for all #include directives. On top of that, -I- stops the folder of the current file from being the first search spot for #include "file", and there's no way to undo that effect of -I-.
  • -iprefix prefix โ€” Sets prefix as the prefix for later -iwithprefix options. If the prefix is a directory, include the final / ๐ŸŒท.
  • -iwithprefix dir, -iwithprefixbefore dir โ€” Tacks dir onto the prefix you set earlier with -iprefix, then adds the result to the include search path โœจ. -iwithprefixbefore puts it in the same place -I would, and -iwithprefix puts it where -idirafter would.
  • -isysroot dir โ€” Basically --sysroot, but it only applies to header files ๐Ÿงธ. The exception is Darwin targets, where it applies to both header files and libraries. Check the --sysroot option for more info.
  • -imultilib dir โ€” Uses dir as a subdirectory of the folder holding target-specific C++ headers ๐ŸŽ€.
  • -nostdinc โ€” Skips the standard system directories for header files ๐Ÿ™…. Only the folders you explicitly give with -I, -iquote, -isystem, and/or -idirafter get searched, plus the folder of the current file if it's relevant.
  • -nostdinc++ โ€” Skips the C++-specific standard directories for header files, but still searches the other standard directories ๐Ÿ’–. (This one is used when building the C++ library.)
  • -Wcomment, -Wcomments โ€” Warns whenever a /* comment-start sequence shows up inside a /* comment, or whenever a backslash-newline shows up in a // comment ๐Ÿ‘€. This warning is enabled by -Wall.
  • -Wtrigraphs โ€” Warns if any trigraphs pop up that might change what the program means ๐Ÿ”ฎ. Trigraphs inside comments don't get warned about, except the ones 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. Want trigraph conversion without the warnings, but still want the other -Wall warnings? Use -trigraphs -Wall -Wno-trigraphs ๐ŸŒˆ.

  • -Wundef โ€” Warns if an undefined identifier gets evaluated in an #if directive ๐Ÿซ . Those identifiers get replaced with zero.
  • -Wexpansion-to-defined โ€” Warns whenever defined shows up in the expansion of a macro, including when the macro gets expanded by an #if directive ๐Ÿšซ. That usage isn't portable. This warning is also enabled by -Wpedantic and -Wextra.
  • -Wunused-macros โ€” Warns about macros defined in the main file that never get used ๐Ÿงน. A macro counts as used if it's expanded or tested for existence at least once. The preprocessor also warns if the macro hasn't been used by the time it gets redefined or undefined.

Built-in macros, macros defined on the command line, and macros defined in include files don't get warned about.

Heads up: if a macro is used, but only inside skipped conditional blocks, the preprocessor still reports it as unused. To dodge the warning in that case, you could improve the scope of the macro's definition, like moving it into the first skipped block. Or you could provide a dummy use with something like:
#if defined the_macro_causing_the_warning
#endif
  • -Wno-endif-labels โ€” Turns off the warning for when an #else or an #endif is followed by text ๐Ÿ™ˆ. This sometimes happens in older programs with code like this:
#if FOO
...
#else FOO
...
#endif FOO

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


โœจ ENVIRONMENT โœจ

This section covers the environment variables that change how CPP operates ๐Ÿงš. You can use them to specify directories or prefixes for searching include files, or to control dependency output ๐Ÿ’œ.

You can also specify places to search with options like -I, and control dependency output with options like -M. These take precedence over environment variables, which in turn take precedence over the configuration of GCC ๐Ÿ‘‘.

  • CPATH, C_INCLUDE_PATH, CPLUS_INCLUDE_PATH, OBJC_INCLUDE_PATH โ€” Each of these holds a list of directories, separated by a special character, kind of like PATH, and that's where the compiler looks for header files ๐Ÿ—บ๏ธ. The special character, "PATH_SEPARATOR", depends on the target and gets set at GCC build time. For Microsoft Windows-based targets it's a semicolon, and for almost every other target it's a colon.

CPATH specifies directories to search as if they were given with -I, but after any paths given with -I options on the command line. This variable gets used no matter which language is being preprocessed ๐ŸŒธ.

The remaining variables only apply when preprocessing the particular language they're named for. Each one specifies directories to search as if they were given with -isystem, but after any paths given with -isystem options on the command line ๐ŸŽ€.

In all of these variables, an empty element tells the compiler to search its current working directory ๐Ÿฆ‹. Empty elements can show up at the beginning or end of a path. For instance, if the value of CPATH is ":/special/include", that does the same thing as -I. -I/special/include โœจ.

  • DEPENDENCIES_OUTPUT โ€” If this variable is set, its value tells CPP how to output dependencies for Make, based on the non-system header files the compiler processes ๐Ÿ“. System header files get ignored in the dependency output.

The value can be just a file name. In that case, the Make rules get written to that file, and the target name gets guessed from the source file name. Or the value can have the form file target, where the rules get written to file using target as the target name ๐Ÿ’….

In other words, this variable does the same job as combining the options -MM and -MF, with an optional -MT switch too ๐Ÿซถ.

  • SUNPRO_DEPENDENCIES โ€” This one is the same as DEPENDENCIES_OUTPUT (see above), except system header files are NOT ignored, so it implies -M rather than -MM ๐ŸŒท. However, the dependence on the main input file gets left out.
  • SOURCE_DATE_EPOCH โ€” If this variable is set, its value is a UNIX timestamp that replaces the current date and time in the "__DATE__" and "__TIME__" macros โฐ. That way, the embedded timestamps stay reproducible ๐Ÿ”.

The value of SOURCE_DATE_EPOCH has to be a UNIX timestamp, which is the number of seconds (excluding leap seconds) since 01 Jan 1970 00:00:00, written in ASCII ๐Ÿงฎ. It's identical to the output of @command{date +%s} on GNU/Linux and other systems that support the %s extension in the "date" command.

The value should be a known timestamp, like the last modification time of the source or package, and the build process should set it ๐Ÿ› ๏ธ.


โœจ SEE ALSO โœจ

gpl(7), gfdl(7), fsf-funding(7), gcc(1), and the Info entries for cpp and gcc ๐Ÿ“š๐Ÿซถ.


Copyright (c) 1987-2020 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 FSF's Front-Cover Text is: A GNU Manual

(b) 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 ๐ŸŽ‰.


That's a wrap, bestie! ๐ŸŽ€๐Ÿ’– This page came from the gcc-10 release and was last stamped 2023-07-07 ๐Ÿฆ‹. Go be iconic with your header files ๐Ÿ’…โœจ

๐Ÿ“ฆ where this page comes from