Summary of gcc compilation and proc compilation under linux

  

Compile the .pc file under linux (that is, the embedded database development language of oracle) The process has two steps: first, the proc preprocessor is compiled into a .pc file. c file: proc test.pc

If you report an error during this period, some library files and header files are not included. Proc common parameter options description: (1) code: indicates the format of the c function generated by the pre-compilation process. When code= ANSI_C, the function prototype parameters conforming to the ANSI_C standard are generated: extern sqlca(log*, void *); when code= KR_C generates function prototype parameters in the following format: extern sqlca(/*_log*, void *_*/); syntax: code=ANSI_C| The default value of KR_C is KR_C. Note: Can be entered on the command line or on the program. (2) DBMS: Specify the version of the oracle database management system used. Syntax: DBMS=NATIVE| V6| V7 default value: NATIVE. Note: You can only enter on the command line. (3) ERRORS: Indicates whether the error message generated when the program is compiled is sent to the terminal and the manifest file. Syntax: ERRORS=YES| NO, sent to the terminal and manifest file when YES, only sent to the manifest file when NO. Default: YES. Note: Can be entered on the program and on the command line. (4) INCLUDE: Specify the directory path of the EXEC SQL INCLUDE file, which is only applicable to the operating system
that uses the directory. Syntax: INCLUDE = PATH (5) MODE: specifies the standard syntax followed by the program: MODE=ORACLE| ISO| There are other standards in ANSI..... (6) ONAME: Specify output file: Syntax: ONAME=PATH+FILENAME(7)LINES: Indicates whether the pre-compiler handler adds the #line command to the output file. (8) INAME: Specify the input file: Syntax: ONAME=PATH+FILENAME will generate the corresponding .c file after pre-compilation, and then compile the .c file: compile with gcc here. Gcc compiled option parameter description: -c only activates preprocessing, compiling, and assembly, that is, he only makes the program into an obj file. Example usage: gcc -c hello.c He will generate .o obj file -S only activate Preprocessing and compiling refers to compiling files into assembly code. Example usage gcc -S hello.c He will generate the assembly code for .s, you can use the text editor to view -E only activate preprocessing, this does not generate files, you need to redirect it to an output file. : gcc -E hello.c > pianoapan.txt gcc -E hello.c |  More Let's take a look, a hello word should also be set to the target name with the code -o processed into 800 lines. By default, the file compiled by gcc is a.out, it is hard to hear, if you and I have the same feeling, change Drop it, haha ​​example usage gcc -o hello.exe hello.c (oh, windows used to it) gcc -o hello.asm -S hello.c -ansi Close gnu c is not compatible with ansi c, activate ansi c's proprietary features (including the prohibition of some asm inline typeof keywords, as well as preprocessor macros such as UNIX, vax, etc., -wall displays warning messages -fno-asm This option implements the part of the ansi option, which prohibits asm, inline and Typeof is used as a keyword. -fno-strict-prototype works only for g++. With this option, g++ will treat functions without arguments as having no explicit arguments and type descriptions, not Parameters. And whether gcc uses this parameter, whether it is a function without parameters, the type that the city does not explicitly state -fthis-is-varialble is to be in line with the traditional C++, you can use this as a general variable. -fcond- Mismatch allows the second and third parameters of the conditional expression Type mismatch, the value of the expression will be void type -funsigned-char -fno-signed-char -fsigned-char -fno-unsigned-char These four parameters are set for the char type, decided to set the char type to unsigned Char (the first two parameters) or signed char (the last two parameters) - include file contains a code, in simple terms, it is a file, when you need another file, you can use it to set, function It is equivalent to using #include in the code. Example usage: gcc hello.c -include /root/pianopan.h-imacros file Extend the macro of the file file to the input file of gcc/g++, the macro definition itself does not appear in the input The file -Dmacro is equivalent to #define macro-Dmacro=defn in C language. It is equivalent to #define macro=defn-Umacro in C language. It is equivalent to #undef macro-undef in C language. Cancel the definition of any non-standard macro - Idir When you use #include"file", gcc/g++ will first look up the header file you made in the current directory. If it is not found, he will return to the default header file directory. If you use -I Directory, he will go back to the directory you have developed. Find, and then look in the usual order. For #include, gcc/g++ will go to the directory definition of -I, can't find it, and then go to the system's default header file directory lookup -I- is to cancel the previous one The function of the parameter, so generally use -idirafter dir after -Idir to find the failure in the -I directory, talk about this directory to find .-iprefix prefix -iwithprefix dir generally used together, when the -I directory search fails, will Look for -nostdinc under prefix+dir to make the compiler no longer find the header file in the default header file directory of the system. It is generally used in conjunction with -I to explicitly limit the location of the header file. -nostdin C++ specifies not to search in the standard path specified by g++. , but still search in other paths, this option is used in the creation of libg++ library -C in the pre-processing, do not delete the comment information, generally and -E use, sometimes analyze the program, use this very convenient -M to generate files Associated information. Include all the source code that the target file depends on. You can test it with gcc -M hello.c, which is very simple. -MM is the same as the one above, but it will ignore the dependencies caused by #include. -MD is the same as -M, but the output will be imported into the .d file - MMD is the same as -MM, but the output will be imported into the .d file -Wa,option This option passes the option to the assembler; if there is an option in the middle The comma divides the option into multiple options and passes it to the assembler - Wl.option. This option passes the option to the linker; if there is a comma in the middle of the option, the option is divided into multiple options.

Copyright © Windows knowledge All Rights Reserved