📄 cppopts.texi
字号:
@itemx iso9899:199x@itemx c9xThe revised ISO C standard, published in December 1999. Beforepublication, this was known as C9X@.@item gnu89The 1990 C standard plus GNU extensions. This is the default.@item gnu99@itemx gnu9xThe 1999 C standard plus GNU extensions.@item c++98The 1998 ISO C++ standard plus amendments.@item gnu++98The same as @option{-std=c++98} plus GNU extensions. This is thedefault for C++ code.@end table@item -I-@opindex I-Split the include path. Any directories specified with @option{-I}options before @option{-I-} are searched only for headers requested with@code{@w{#include "@var{file}"}}; they are not searched for@code{@w{#include <@var{file}>}}. If additional directories arespecified with @option{-I} options after the @option{-I-}, thosedirectories are searched for all @samp{#include} directives.In addition, @option{-I-} inhibits the use of the directory of the currentfile directory as the first search directory for @code{@w{#include"@var{file}"}}.@ifset cppmanual@xref{Search Path}.@end ifsetThis option has been deprecated.@item -nostdinc@opindex nostdincDo not search the standard system directories for header files.Only the directories you have specified with @option{-I} options(and the directory of the current file, if appropriate) are searched.@item -nostdinc++@opindex nostdinc++Do not search for header files in the C++-specific standard directories,but do still search the other standard directories. (This option isused when building the C++ library.)@item -include @var{file}@opindex includeProcess @var{file} as if @code{#include "file"} appeared as the firstline of the primary source file. However, the first directory searchedfor @var{file} is the preprocessor's working directory @emph{instead of}the directory containing the main source file. If not found there, itis searched for in the remainder of the @code{#include "@dots{}"} searchchain as normal.If multiple @option{-include} options are given, the files are includedin the order they appear on the command line.@item -imacros @var{file}@opindex imacrosExactly like @option{-include}, except that any output produced byscanning @var{file} is thrown away. Macros it defines remain defined.This allows you to acquire all the macros from a header without alsoprocessing its declarations.All files specified by @option{-imacros} are processed before all filesspecified by @option{-include}.@item -idirafter @var{dir}@opindex idirafterSearch @var{dir} for header files, but do it @emph{after} alldirectories specified with @option{-I} and the standard system directorieshave been exhausted. @var{dir} is treated as a system include directory.If @var{dir} begins with @code{=}, then the @code{=} will be replacedby the sysroot prefix; see @option{--sysroot} and @option{-isysroot}.@item -iprefix @var{prefix}@opindex iprefixSpecify @var{prefix} as the prefix for subsequent @option{-iwithprefix}options. If the prefix represents a directory, you should include thefinal @samp{/}.@item -iwithprefix @var{dir}@itemx -iwithprefixbefore @var{dir}@opindex iwithprefix@opindex iwithprefixbeforeAppend @var{dir} to the prefix specified previously with@option{-iprefix}, and add the resulting directory to the include searchpath. @option{-iwithprefixbefore} puts it in the same place @option{-I}would; @option{-iwithprefix} puts it where @option{-idirafter} would.@item -isysroot @var{dir}@opindex isysrootThis option is like the @option{--sysroot} option, but applies only toheader files. See the @option{--sysroot} option for more information.@item -imultilib @var{dir}@opindex imultilibUse @var{dir} as a subdirectory of the directory containingtarget-specific C++ headers.@item -isystem @var{dir}@opindex isystemSearch @var{dir} for header files, after all directories specified by@option{-I} but before the standard system directories. Mark itas a system directory, so that it gets the same special treatment asis applied to the standard system directories.@ifset cppmanual@xref{System Headers}.@end ifsetIf @var{dir} begins with @code{=}, then the @code{=} will be replacedby the sysroot prefix; see @option{--sysroot} and @option{-isysroot}.@item -iquote @var{dir}@opindex iquoteSearch @var{dir} only for header files requested with@code{@w{#include "@var{file}"}}; they are not searched for@code{@w{#include <@var{file}>}}, before all directories specified by@option{-I} and before the standard system directories.@ifset cppmanual@xref{Search Path}.@end ifsetIf @var{dir} begins with @code{=}, then the @code{=} will be replacedby the sysroot prefix; see @option{--sysroot} and @option{-isysroot}.@item -fdirectives-only@opindex fdirectives-onlyWhen preprocessing, handle directives, but do not expand macros.The option's behavior depends on the @option{-E} and @option{-fpreprocessed}options.With @option{-E}, preprocessing is limited to the handling of directivessuch as @code{#define}, @code{#ifdef}, and @code{#error}. Otherpreprocessor operations, such as macro expansion and trigraphconversion are not performed. In addition, the @option{-dD} option isimplicitly enabled.With @option{-fpreprocessed}, predefinition of command line and mostbuiltin macros is disabled. Macros such as @code{__LINE__}, which arecontextually dependent, are handled normally. This enables compilation offiles previously preprocessed with @code{-E -fdirectives-only}.With both @option{-E} and @option{-fpreprocessed}, the rules for@option{-fpreprocessed} take precedence. This enables full preprocessing offiles previously preprocessed with @code{-E -fdirectives-only}.@item -fdollars-in-identifiers@opindex fdollars-in-identifiers@anchor{fdollars-in-identifiers}Accept @samp{$} in identifiers.@ifset cppmanual @xref{Identifier characters}.@end ifset@item -fextended-identifiers@opindex fextended-identifiersAccept universal character names in identifiers. This option isexperimental; in a future version of GCC, it will be enabled bydefault for C99 and C++.@item -fpreprocessed@opindex fpreprocessedIndicate to the preprocessor that the input file has already beenpreprocessed. This suppresses things like macro expansion, trigraphconversion, escaped newline splicing, and processing of most directives.The preprocessor still recognizes and removes comments, so that you canpass a file preprocessed with @option{-C} to the compiler withoutproblems. In this mode the integrated preprocessor is little more thana tokenizer for the front ends.@option{-fpreprocessed} is implicit if the input file has one of theextensions @samp{.i}, @samp{.ii} or @samp{.mi}. These are theextensions that GCC uses for preprocessed files created by@option{-save-temps}.@item -ftabstop=@var{width}@opindex ftabstopSet the distance between tab stops. This helps the preprocessor reportcorrect column numbers in warnings or errors, even if tabs appear on theline. If the value is less than 1 or greater than 100, the option isignored. The default is 8.@item -fexec-charset=@var{charset}@opindex fexec-charset@cindex character set, executionSet the execution character set, used for string and characterconstants. The default is UTF-8. @var{charset} can be any encodingsupported by the system's @code{iconv} library routine.@item -fwide-exec-charset=@var{charset}@opindex fwide-exec-charset@cindex character set, wide executionSet the wide execution character set, used for wide string andcharacter constants. The default is UTF-32 or UTF-16, whichevercorresponds to the width of @code{wchar_t}. As with@option{-fexec-charset}, @var{charset} can be any encoding supportedby the system's @code{iconv} library routine; however, you will haveproblems with encodings that do not fit exactly in @code{wchar_t}.@item -finput-charset=@var{charset}@opindex finput-charset@cindex character set, inputSet the input character set, used for translation from the characterset of the input file to the source character set used by GCC@. If thelocale does not specify, or GCC cannot get this information from thelocale, the default is UTF-8. This can be overridden by either the localeor this command line option. Currently the command line option takesprecedence if there's a conflict. @var{charset} can be any encodingsupported by the system's @code{iconv} library routine.@item -fworking-directory@opindex fworking-directory@opindex fno-working-directoryEnable generation of linemarkers in the preprocessor output that willlet the compiler know the current working directory at the time ofpreprocessing. When this option is enabled, the preprocessor willemit, after the initial linemarker, a second linemarker with thecurrent working directory followed by two slashes. GCC will use thisdirectory, when it's present in the preprocessed input, as thedirectory emitted as the current working directory in some debugginginformation formats. This option is implicitly enabled if debugginginformation is enabled, but this can be inhibited with the negatedform @option{-fno-working-directory}. If the @option{-P} flag ispresent in the command line, this option has no effect, since no@code{#line} directives are emitted whatsoever.@item -fno-show-column@opindex fno-show-columnDo not print column numbers in diagnostics. This may be necessary ifdiagnostics are being scanned by a program that does not understand thecolumn numbers, such as @command{dejagnu}.@item -A @var{predicate}=@var{answer}@opindex AMake an assertion with the predicate @var{predicate} and answer@var{answer}. This form is preferred to the older form @option{-A@var{predicate}(@var{answer})}, which is still supported, becauseit does not use shell special characters.@ifset cppmanual@xref{Assertions}.@end ifset@item -A -@var{predicate}=@var{answer}Cancel an assertion with the predicate @var{predicate} and answer@var{answer}.@item -dCHARS@var{CHARS} is a sequence of one or more of the following characters,and must not be preceded by a space. Other characters are interpretedby the compiler proper, or reserved for future versions of GCC, and soare silently ignored. If you specify characters whose behaviorconflicts, the result is undefined.@table @samp@item M@opindex dMInstead of the normal output, generate a list of @samp{#define}directives for all the macros defined during the execution of thepreprocessor, including predefined macros. This gives you a way offinding out what is predefined in your version of the preprocessor.Assuming you have no file @file{foo.h}, the command@smallexampletouch foo.h; cpp -dM foo.h@end smallexample@noindentwill show all the predefined macros.If you use @option{-dM} without the @option{-E} option, @option{-dM} isinterpreted as a synonym for @option{-fdump-rtl-mach}.@xref{Debugging Options, , ,gcc}.@item D@opindex dDLike @samp{M} except in two respects: it does @emph{not} include thepredefined macros, and it outputs @emph{both} the @samp{#define}directives and the result of preprocessing. Both kinds of output go tothe standard output file.@item N@opindex dNLike @samp{D}, but emit only the macro names, not their expansions.@item I@opindex dIOutput @samp{#include} directives in addition to the result ofpreprocessing.@end table@item -P@opindex PInhibit generation of linemarkers in the output from the preprocessor.This might be useful when running the preprocessor on something that isnot C code, and will be sent to a program which might be confused by thelinemarkers.@ifset cppmanual@xref{Preprocessor Output}.@end ifset@item -C@opindex CDo not discard comments. All comments are passed through to the outputfile, except for comments in processed directives, which are deletedalong with the directive.You should be prepared for side effects when using @option{-C}; itcauses the preprocessor to treat comments as tokens in their own right.For example, comments appearing at the start of what would be adirective line have the effect of turning that line into an ordinarysource line, since the first token on the line is no longer a @samp{#}.@item -CCDo not discard comments, including during macro expansion. This islike @option{-C}, except that comments contained within macros arealso passed through to the output file where the macro is expanded.In addition to the side-effects of the @option{-C} option, the@option{-CC} option causes all C++-style comments inside a macroto be converted to C-style comments. This is to prevent later useof that macro from inadvertently commenting out the remainder ofthe source line.The @option{-CC} option is generally used to support lint comments.@item -traditional-cpp@opindex traditional-cppTry to imitate the behavior of old-fashioned C preprocessors, asopposed to ISO C preprocessors.@ifset cppmanual@xref{Traditional Mode}.@end ifset@item -trigraphs@opindex trigraphsProcess trigraph sequences.@ifset cppmanual@xref{Initial processing}.@end ifset@ifclear cppmanualThese are three-character sequences, all starting with @samp{??}, thatare defined by ISO C to stand for single characters. For example,@samp{??/} stands for @samp{\}, so @samp{'??/n'} is a characterconstant for a newline. By default, GCC ignores trigraphs, but instandard-conforming modes it converts them. See the @option{-std} and@option{-ansi} options.The nine trigraphs and their replacements are@smallexampleTrigraph: ??( ??) ??< ??> ??= ??/ ??' ??! ??-Replacement: [ ] @{ @} # \ ^ | ~@end smallexample@end ifclear@item -remap@opindex remapEnable special code to work around file systems which only permit veryshort file names, such as MS-DOS@.@itemx --help@itemx --target-help@opindex help@opindex target-helpPrint text describing all the command line options instead ofpreprocessing anything.@item -v@opindex vVerbose mode. Print out GNU CPP's version number at the beginning ofexecution, and report the final form of the include path.@item -H@opindex HPrint the name of each header file used, in addition to other normalactivities. Each name is indented to show how deep in the@samp{#include} stack it is. Precompiled header files are alsoprinted, even if they are found to be invalid; an invalid precompiledheader file is printed with @samp{...x} and a valid one with @samp{...!} .@item -version@itemx --version@opindex versionPrint out GNU CPP's version number. With one dash, proceed topreprocess as normal. With two dashes, exit immediately.@end table
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -