[GCC for C] compilation options-ide masks the sky

Source: Internet
Author: User
Tags naming convention

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.