📄 gcc.1
字号:
.B c\-header\c\&\|', `\|\c.B c++\c\&\|',`\|\c.B cpp\-output\c\&\|', `\|\c.B assembler\c\&\|', and `\|\c.B assembler\-with\-cpp\c\&\|'..TP.B \-x noneTurn off any specification of a language, so that subsequent files arehandled according to their file name suffixes (as they are if `\|\c.B \-x\c\&\|'has not been used at all)..PPIf you want only some of the four stages (preprocess, compile,assemble, link), you can use`\|\c.B \-x\c\&\|' (or filename suffixes) to tell \c.B gcc\c\& where to start, andone of the options `\|\c.B \-c\c\&\|', `\|\c.B \-S\c\&\|', or `\|\c.B \-E\c\&\|' to say where.B gcc\c\& is to stop. Note that some combinations (for example,`\|\c.B \-x cpp\-output \-E\c\&\|') instruct \c.B gcc\c\& to do nothing at all..TP.B \-cCompile or assemble the source files, but do not link. The compileroutput is an object file corresponding to each source file..SpBy default, GCC makes the object file name for a source file by replacingthe suffix `\|\c.B .c\c\&\|', `\|\c.B .i\c\&\|', `\|\c.B .s\c\&\|', etc., with `\|\c.B .o\c\&\|'. Use.B \-o\c\& to select another name..SpGCC ignores any unrecognized input files (those that do not requirecompilation or assembly) with the.B \-coption..TP.B \-SStop after the stage of compilation proper; do not assemble. The outputis an assembler code file for each non-assembler inputfile specified..SpBy default, GCC makes the assembler file name for a source file byreplacing the suffix `\|\c.B .c\c\&\|', `\|\c.B .i\c\&\|', etc., with `\|\c.B .s\c\&\|'. Use.B \-o\c\& to select another name..SpGCC ignores any input files that don't require compilation..TP.B \-EStop after the preprocessing stage; do not run the compiler proper. Theoutput is preprocessed source code, which is sent to thestandard output..SpGCC ignores input files which don't require preprocessing..TP.BI "\-o " filePlace output in file \c.I file\c\&. This applies regardless to whateversort of output GCC is producing, whether it be an executable file,an object file, an assembler file or preprocessed C code..SpSince only one output file can be specified, it does not make sense touse `\|\c.B \-o\c\&\|' when compiling more than one input file, unless you areproducing an executable file as output..SpIf you do not specify `\|\c.B \-o\c\&\|', the default is to put an executable filein `\|\c.B a.out\c\&\|', the object file for `\|\c.I source\c.B \&.\c.I suffix\c\&\c\&\|' in`\|\c.I source\c.B \&.o\c\&\|', its assembler file in `\|\c.I source\c.B \&.s\c\&\|', andall preprocessed C source on standard output..TP.B \-vPrint (on standard error output) the commands executed to run the stagesof compilation. Also print the version number of the compiler driverprogram and of the preprocessor and the compiler proper..TP.B \-pipeUse pipes rather than temporary files for communication between thevarious stages of compilation. This fails to work on some systems wherethe assembler cannot read from a pipe; but the GNU assembler hasno trouble..PP.SH LANGUAGE OPTIONSThe following options control the dialect of C that the compileraccepts:.TP.B \-ansiSupport all ANSI standard C programs..SpThis turns off certain features of GNU C that are incompatible withANSI C, such as the \c.B asm\c\&, \c.B inline\c\& and \c.B typeofkeywords, and predefined macros such as \c.B unix\c\& and \c.B vaxthat identify the type of system you are using. It also enables theundesirable and rarely used ANSI trigraph feature, and disallows `\|\c.B $\c\&\|' as part of identifiers..SpThe alternate keywords \c.B _\|_asm_\|_\c\&, \c.B _\|_extension_\|_\c\&,.B _\|_inline_\|_\c\& and \c.B _\|_typeof_\|_\c\& continue to work despite`\|\c.B \-ansi\c\&\|'. You would not want to use them in an ANSI C program, ofcourse, but it is useful to put them in header files that might be includedin compilations done with `\|\c.B \-ansi\c\&\|'. Alternate predefined macrossuch as \c.B _\|_unix_\|_\c\& and \c.B _\|_vax_\|_\c\& are also available, with orwithout `\|\c.B \-ansi\c\&\|'..SpThe `\|\c.B \-ansi\c\&\|' option does not cause non-ANSI programs to berejected gratuitously. For that, `\|\c.B \-pedantic\c\&\|' is required inaddition to `\|\c.B \-ansi\c\&\|'..SpThe preprocessor predefines a macro \c.B _\|_STRICT_ANSI_\|_\c\& when you use the `\|\c.B \-ansi\c\&\|'option. Some header files may notice this macro and refrainfrom declaring certain functions or defining certain macros that theANSI standard doesn't call for; this is to avoid interfering with anyprograms that might use these names for other things..TP.B \-fno\-asmDo not recognize \c.B asm\c\&, \c.B inline\c\& or \c.B typeof\c\& as akeyword. These words may then be used as identifiers. You canuse \c.B _\|_asm_\|_\c\&, \c.B _\|_inline_\|_\c\& and \c.B _\|_typeof_\|_\c\& instead.`\|\c.B \-ansi\c\&\|' implies `\|\c.B \-fno\-asm\c\&\|'..TP.B \-fno\-builtinDon't recognize built-in functions that do not begin with two leadingunderscores. Currently, the functions affected include \c.B _exit\c\&,.B abort\c\&, \c.B abs\c\&, \c.B alloca\c\&, \c.B cos\c\&, \c.B exit\c\&,.B fabs\c\&, \c.B labs\c\&, \c.B memcmp\c\&, \c.B memcpy\c\&, \c.B sin\c\&,.B sqrt\c\&, \c.B strcmp\c\&, \c.B strcpy\c\&, and \c.B strlen\c\&..SpThe `\|\c.B \-ansi\c\&\|' option prevents \c.B alloca\c\& and \c.B _exit\c\& frombeing builtin functions..TP.B \-fhostedCompile for a hosted environment; this implies the `\|\c.B \-fbuiltin\c\&\|' option, and implies that suspicious declarations of.B main\c\& should be warned about..TP.B \-ffreestandingCompile for a freestanding environment; this implies the `\|\c.B \-fno-builtin\c\&\|' option, and implies that.B main\c\& has no special requirements..TP.B \-fno\-strict\-prototypeTreat a function declaration with no arguments, such as `\|\c.B int foo();\c\&\|', as C would treat it\(em\&as saying nothing about the number ofarguments or their types (C++ only). Normally, such a declaration inC++ means that the function \c.B foo\c\& takes no arguments..TP.B \-trigraphsSupport ANSI C trigraphs. The `\|\c.B \-ansi\c\&\|' option implies `\|\c.B \-trigraphs\c\&\|'..TP.B \-traditionalAttempt to support some aspects of traditional C compilers.For details, see the GNU C Manual; the duplicate list herehas been deleted so that we won't get complaints when itis out of date..SpBut one note about C++ programs only (not C). `\|\c.B \-traditional\c\&\|' has one additional effect for C++: assignment to.B thisis permitted. This is the same as the effect of `\|\c.B \-fthis\-is\-variable\c\&\|'..TP.B \-traditional\-cppAttempt to support some aspects of traditional C preprocessors.This includes the items that specifically mention the preprocessor above,but none of the other effects of `\|\c.B \-traditional\c\&\|'..TP.B \-fdollars\-in\-identifiersPermit the use of `\|\c.B $\c\&\|' in identifiers (C++ only). You can also use`\|\c.B \-fno\-dollars\-in\-identifiers\c\&\|' to explicitly prohibit use of`\|\c.B $\c\&\|'. (GNU C++ allows `\|\c.B $\c\&\|' by default on some target systemsbut not others.).TP.B \-fenum\-int\-equivPermit implicit conversion of \c.B int\c\& to enumeration types (C++only). Normally GNU C++ allows conversion of \c.B enum\c\& to \c.B int\c\&,but not the other way around..TP.B \-fexternal\-templatesProduce smaller code for template declarations, by generating only asingle copy of each template function where it is defined (C++ only).To use this option successfully, you must also mark all files thatuse templates with either `\|\c.B #pragma implementation\c\&\|' (the definition) or`\|\c.B #pragma interface\c\&\|' (declarations).When your code is compiled with `\|\c.B \-fexternal\-templates\c\&\|', alltemplate instantiations are external. You must arrange for allnecessary instantiations to appear in the implementation file; you cando this with a \c.B typedef\c\& that references each instantiation needed.Conversely, when you compile using the default option`\|\c.B \-fno\-external\-templates\c\&\|', all template instantiations areexplicitly internal..TP.B \-fall\-virtualTreat all possible member functions as virtual, implicitly. Allmember functions (except for constructor functions and.B newor.B deletemember operators) are treated as virtual functions of the class wherethey appear..SpThis does not mean that all calls to these member functions will bemade through the internal table of virtual functions. Under somecircumstances, the compiler can determine that a call to a givenvirtual function can be made directly; in these cases the calls aredirect in any case..TP.B \-fcond\-mismatchAllow conditional expressions with mismatched types in the second andthird arguments. The value of such an expression is void..TP.B \-fthis\-is\-variablePermit assignment to \c.B this\c\& (C++ only). The incorporation ofuser-defined free store management into C++ has made assignment to`\|\c.B this\c\&\|' an anachronism. Therefore, by default it is invalid toassign to \c.B this\c\& within a class member function. However, forbackwards compatibility, you can make it valid with`\|\c.B \-fthis-is-variable\c\&\|'..TP.B \-funsigned\-charLet the type \c.B char\c\& be unsigned, like \c.B unsigned char\c\&..SpEach kind of machine has a default for what \c.B char\c\& shouldbe. It is either like \c.B unsigned char\c\& by default or like.B signed char\c\& by default..SpIdeally, a portable program should always use \c.B signed char\c\& or.B unsigned char\c\& when it depends on the signedness of an object.But many programs have been written to use plain \c.B char\c\& andexpect it to be signed, or expect it to be unsigned, depending on themachines they were written for. This option, and its inverse, let youmake such a program work with the opposite default..SpThe type \c.B char\c\& is always a distinct type from each of.B signed char\c\& and \c.B unsigned char\c\&, even though its behavioris always just like one of those two..TP.B \-fsigned\-charLet the type \c.B char\c\& be signed, like \c.B signed char\c\&..SpNote that this is equivalent to `\|\c.B \-fno\-unsigned\-char\c\&\|', which isthe negative form of `\|\c.B \-funsigned\-char\c\&\|'. Likewise,`\|\c.B \-fno\-signed\-char\c\&\|' is equivalent to `\|\c.B \-funsigned\-char\c\&\|'..TP.B \-fsigned\-bitfields.TP.B \-funsigned\-bitfields.TP.B \-fno\-signed\-bitfields.TP.B \-fno\-unsigned\-bitfieldsThese options control whether a bitfield issigned or unsigned, when declared with no explicit `\|\c.B signed\c\&\|' or `\|\c.B unsigned\c\&\|' qualifier. By default, such a bitfield issigned, because this is consistent: the basic integer types such as.B int\c\& are signed types..SpHowever, when you specify `\|\c.B \-traditional\c\&\|', bitfields are all unsignedno matter what..TP.B \-fwritable\-stringsStore string constants in the writable data segment and don't uniquizethem. This is for compatibility with old programs which assume theycan write into string constants. `\|\c.B \-traditional\c\&\|' also has thiseffect..SpWriting into string constants is a very bad idea; \*(lqconstants\*(rq shouldbe constant..SH PREPROCESSOR OPTIONSThese options control the C preprocessor, which is run on each C sourcefile before actual compilation..PPIf you use the `\|\c.B \-E\c\&\|' option, GCC does nothing except preprocessing.Some of these options make sense only together with `\|\c.B \-E\c\&\|' becausethey cause the preprocessor output to be unsuitable for actualcompilation..TP.BI "\-include " "file"Process \c.I file\c\& as input before processing the regular input file.In effect, the contents of \c.I file\c\& are compiled first. Any `\|\c.B \-D\c\&\|'and `\|\c.B \-U\c\&\|' options on the command line are always processed before`\|\c.B \-include \c.I file\c\&\c\&\|', regardless of the order in which they arewritten. All the `\|\c.B \-include\c\&\|' and `\|\c.B \-imacros\c\&\|' options areprocessed in the order in which they are written..TP.BI "\-imacros " fileProcess \c.I file\c\& as input, discarding the resulting output, beforeprocessing the regular input file. Because the output generated from.I file\c\& is discarded, the only effect of `\|\c.B \-imacros \c.I file\c\&\c
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -