📄 gcc.hlp
字号:
--target-help Print (on the standard output) a description of target specific command line options for each tool. --version Display the version number and copyrights of the invoked GCC. Compiling C++ Programs C++ source files conventionally use one of the suffixes .C, .cc, .cpp, .c++, .cp, or .cxx; preprocessed C++ files use the suffix .ii. GCC recognizes files with these names and compiles them as C++ programs even if you call the compiler the same way as for compiling C programs (usually with the name gcc). However, C++ programs often require class libraries as well as a com- piler that understands the C++ language---and under some circumstances, you might want to compile programs from standard input, or otherwise without a suffix that flags them as C++ programs. g++ is a program that calls GCC with the default language set to C++, and automatically specifies linking against the C++ library. On many systems, g++ is also installed with the name c++. When you compile C++ programs, you may specify many of the same com- mand-line options that you use for compiling programs in any language; or command-line options meaningful for C and related languages; or options that are meaningful only for C++ programs. Options Controlling C Dialect The following options control the dialect of C (or languages derived from C, such as C++ and Objective-C) that the compiler accepts: -ansi In C mode, support all ISO C89 programs. In C++ mode, remove GNU extensions that conflict with ISO C++. This turns off certain features of GCC that are incompatible with ISO C89 (when compiling C code), or of standard C++ (when compiling C++ code), such as the "asm" and "typeof" keywords, and predefined macros such as "unix" and "vax" that identify the type of system you are using. It also enables the undesirable and rarely used ISO trigraph feature. For the C compiler, it disables recognition of C++ style // comments as well as the "inline" keyword. The alternate keywords "__asm__", "__extension__", "__inline__" and "__typeof__" continue to work despite -ansi. You would not want to use them in an ISO C program, of course, but it is useful to put them in header files that might be included in compilations done with -ansi. Alternate predefined macros such as "__unix__" and "__vax__" are also available, with or without -ansi. The -ansi option does not cause non-ISO programs to be rejected gratuitously. For that, -pedantic is required in addition to -ansi. The macro "__STRICT_ANSI__" is predefined when the -ansi option is used. Some header files may notice this macro and refrain from declaring certain functions or defining certain macros that the ISO standard doesn't call for; this is to avoid interfering with any programs that might use these names for other things. Functions which would normally be built in but do not have seman- tics defined by ISO C (such as "alloca" and "ffs") are not built-in functions with -ansi is used. -std= Determine the language standard. This option is currently only supported when compiling C. A value for this option must be pro- vided; possible values are c89 iso9899:1990 ISO C89 (same as -ansi). iso9899:199409 ISO C89 as modified in amendment 1. c99 c9x iso9899:1999 iso9899:199x ISO C99. Note that this standard is not yet fully supported; see <http://gcc.gnu.org/gcc-3.1/c99status.html> for more infor- mation. The names c9x and iso9899:199x are deprecated. gnu89 Default, ISO C89 plus GNU extensions (including some C99 fea- tures). gnu99 gnu9x ISO C99 plus GNU extensions. When ISO C99 is fully implemented in GCC, this will become the default. The name gnu9x is depre- cated. Even when this option is not specified, you can still use some of the features of newer standards in so far as they do not conflict with previous C standards. For example, you may use "__restrict__" even when -std=c99 is not specified. The -std options specifying some version of ISO C have the same effects as -ansi, except that features that were not in ISO C89 but are in the specified version (for example, // comments and the "inline" keyword in ISO C99) are not disabled. -aux-info filename Output to the given filename prototyped declarations for all func- tions declared and/or defined in a translation unit, including those in header files. This option is silently ignored in any lan- guage other than C. Besides declarations, the file indicates, in comments, the origin of each declaration (source file and line), whether the declaration was implicit, prototyped or unprototyped (I, N for new or O for old, respectively, in the first character after the line number and the colon), and whether it came from a declaration or a definition (C or F, respectively, in the following character). In the case of function definitions, a K&R-style list of arguments followed by their declarations is also provided, inside comments, after the declaration. -fno-asm Do not recognize "asm", "inline" or "typeof" as a keyword, so that code can use these words as identifiers. You can use the keywords "__asm__", "__inline__" and "__typeof__" instead. -ansi implies -fno-asm. In C++, this switch only affects the "typeof" keyword, since "asm" and "inline" are standard keywords. You may want to use the -fno-gnu-keywords flag instead, which has the same effect. In C99 mode (-std=c99 or -std=gnu99), this switch only affects the "asm" and "typeof" keywords, since "inline" is a standard keyword in ISO C99. -fno-builtin -fno-builtin-function (C and Objective-C only) Don't recognize built-in functions that do not begin with __builtin_ as prefix. GCC normally generates special code to handle certain built-in functions more efficiently; for instance, calls to "alloca" may become single instructions that adjust the stack directly, and calls to "memcpy" may become inline copy loops. The resulting code is often both smaller and faster, but since the function calls no longer appear as such, you cannot set a breakpoint on those calls, nor can you change the behavior of the functions by linking with a different library. In C++, -fno-builtin is always in effect. The -fbuiltin option has no effect. Therefore, in C++, the only way to get the optimization benefits of built-in functions is to call the function using the __builtin_ prefix. The GNU C++ Standard Library uses built-in functions to implement many functions (like "std::strchr"), so that you automatically get efficient code. With the -fno-builtin-function option, not available when compiling C++, only the built-in function function is disabled. function must not begin with __builtin_. If a function is named this is not built-in in this version of GCC, this option is ignored. There is no corresponding -fbuiltin-function option; if you wish to enable built-in functions selectively when using -fno-builtin or -ffree- standing, you may define macros such as: #define abs(n) __builtin_abs ((n)) #define strcpy(d, s) __builtin_strcpy ((d), (s)) -fhosted Assert that compilation takes place in a hosted environment. This implies -fbuiltin. A hosted environment is one in which the entire standard library is available, and in which "main" has a return type of "int". Examples are nearly everything except a kernel. This is equivalent to -fno-freestanding. -ffreestanding Assert that compilation takes place in a freestanding environment. This implies -fno-builtin. A freestanding environment is one in which the standard library may not exist, and program startup may not necessarily be at "main". The most obvious example is an OS kernel. This is equivalent to -fno-hosted. -trigraphs Support ISO C trigraphs. The -ansi option (and -std options for strict ISO C conformance) implies -trigraphs. -no-integrated-cpp Invoke the external cpp during compilation. The default is to use the integrated cpp (internal cpp). This option also allows a user- supplied cpp via the -B option. This flag is applicable in both C and C++ modes. We do not guarantee to retain this option in future, and we may change its semantics. -traditional Attempt to support some aspects of traditional C compilers. Specifically: o All "extern" declarations take effect globally even if they are written inside of a function definition. This includes implicit declarations of functions. o The newer keywords "typeof", "inline", "signed", "const" and "volatile" are not recognized. (You can still use the alterna- tive keywords such as "__typeof__", "__inline__", and so on.) o Comparisons between pointers and integers are always allowed. o Integer types "unsigned short" and "unsigned char" promote to "unsigned int". o Out-of-range floating point literals are not an error. o Certain constructs which ISO regards as a single invalid pre- processing number, such as 0xe-0xd, are treated as expressions instead. o String ``constants'' are not necessarily constant; they are stored in writable space, and identical looking constants are allocated separately. (This is the same as the effect of -fwritable-strings.) o All automatic variables not declared "register" are preserved by "longjmp". Ordinarily, GNU C follows ISO C: automatic vari- ables not declared "volatile" may be clobbered. o The character escape sequences \x and \a evaluate as the lit- eral characters x and a respectively. Without -traditional, \x is a prefix for the hexadecimal representation of a character, and \a produces a bell. This option is deprecated and may be removed. You may wish to use -fno-builtin as well as -traditional if your program uses names that are normally GNU C built-in functions for other purposes of its own. You cannot use -traditional if you include any header files that rely on ISO C features. Some vendors are starting to ship systems with ISO C header files and you cannot use -traditional on such systems to compile files that include any system headers. The -traditional option also enables -traditional-cpp. -traditional-cpp Attempt to support some aspects of traditional C preprocessors. See the GNU CPP manual for details. -fcond-mismatch Allow conditional expressions with mismatched types in the second and third arguments. The value of such an expression is void. This option is not supported for C++. -funsigned-char Let the type "char" be unsigned, like "unsigned char". Each kind of machine has a default for what "char" should be. It is either like "unsigned char" by default or like "signed char" by default. Ideally, a portable program should always use "signed char" or "unsigned char" when it depends on the signedness of an object. But many programs have been written to use plain "char" and expect it to be signed, or expect it to be unsigned, depending on the machines they were written for. This option, and its inverse, let you make such a program work with the opposite default. The type "char" is always a distinct type from each of "signed char" or "unsigned char", even though its behavior is always just like one of those two. -fsigned-char Let the type "char" be signed, like "signed char". Note that this is equivalent to -fno-unsigned-char, which is the negative form of -funsigned-char. Likewise, the option -fno-signed-char is equivalent to -funsigned-char. -fsigned-bitfields -funsigned-bitfields -fno-signed-bitfields -fno-unsigned-bitfields These options control whether a bit-field is signed or unsigned, when the declaration does not use either "signed" or "unsigned". By default, such a bit-field is signed, because this is consistent: the basic integer types such as "int" are signed types. However, when -traditional is used, bit-fields are all unsigned no matter what. -fwritable-strings Store string constants in the writable data segment and don't uniquize them. This is for compatibility with old programs which assume they can write into string constants. The option -tradi- tional also has this effect. Writing into string constants is a very bad idea; ``constants'' should be constant. -fallow-single-precision Do not promote single precision math operations to double preci- sion, even when compiling with -traditional. Traditional K&R C promotes all floating point operations to double precision, regardless of the sizes of the operands. On the archi- tecture for which you are compiling, single precision may be faster than double precision. If you must use -traditional, but want to use single precision operations when the operands are single preci- sion, use this option. This option has no effect when compiling with ISO or GNU C conventions (the default).
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -