Compilation options
--------- The sky Covered by IDE
/***************************************
* GCC for C Language
***************************************/
Single Source to Executable
$ GCC helloworld. C [-O Howdy]
A.exe
______________________________________
Source file to object file
$ Gcc-C helloworld. C [-O harumph. O]
The default name is the same as the original file name, with the suffix. o
-C indicates that not only the object file is retained, but the connection process is ignored.
______________________________________
Multiple source files to Executable
$ GCC hellomain. c sayhello. C-O hello
______________________________________
Preprocessing
$ Gcc-e helloworld. C [-O helloworld. I]
No file is output by default. If the output is a. I file
-E code after macro expansion
____________________________________
Generating assembly language
$ Gcc-s helloworld. c
-S generates the hellowordl. s assembly language file
____________________________________
Creating a static library
1. Generate the. o file
$ Gcc-C hellofirst. c hellosecond. c
2. Generate the. A file
$ Ar-r libhello. A hellofirst. O hellosecond. o
Note static library naming rules
3. Connection
$ GCC twohellos. c libhello. A-O twohellos
____________________________________
Creating a shared library
1. Generate the. o file
$ Gcc-C-FPIC shellofirst. c shellosecond. c
-FPIC allows the. O output module to be generated in an address-oriented manner. [PIC: Position independent code]
2. Generate. So
$ Gcc-shared shellofirst. O shellosecond. O-O hello. So
3. Connection
$ GCC stwohellos. c hello. So-O stwohellos
Note: values 1 and 2 can be merged
$ Gcc-FPIC-shared shellofirst. c shellosecond. C-O hello. So
_____________________________________
Overriding the naming convention
$ Gcc-XC helloworld. jxj-O helloworld
-XC for C language source code, the default suffix is. C, but other suffix files can also be used as C, you need to add the-x Option
_______________________________________
Create a header file
$ GCC sayhello. C-aux-Info sayhello. h
$ GCC *. C-aux-Info prototypes. h
However, this header file contains too many function prototypes. Apart from user-defined functions, function prototypes in the standard library are listed.