[state-Embedded notes] [012] [GCC Program compilation]

Source: Internet
Author: User

GCC Features

The GCC (gun C Compiler) is a powerful, performance-rich multi-platform compiler that is launched by gun. The efficiency of the execution is higher than the average compiler 20%~30%.

Basic uses of GCC

gcc [options] Filenames

GCC compilation process

Hello.c-> Precompiled->hello.i-> compilation->hello.s-> compilation->hello.o-> link->hello

GCC-E hello.c-o hello.i "-e" means to perform preprocessing "-o" for output file name

Gcc-s hello.i-o Hello.s "-S" means to perform the compilation

Gcc-c hello.s-o hello.o "-C" means execution assembly

GCC hello.o-o Hello means execution link

Common file types

. c:c file

. h: Header files

. S: assembly file

. O: Target file

. C or. cc or. cxx:c++ files

. A: Library files

GCC compilation options

-o FileName: Specifies the output file name

-O: Optimizations to the compiler, such as removing variables that are not used in the program

Time/FILENAME Statistics program uptime

-o2: Optimized for compiler, more than-O

-C: Do not link, generate. o File

-G: Generate a program with debugging information, debugging with GDB requires the compiler to have this option

-I: Add non-standard header file path, GCC standard look for header file path/usr/include/

-wall: Generate all warnings

-W: Do not generate any warnings

-d (macro): definition (macro) macros, equivalent to using # define (macro) in a program

[state-Embedded notes] [012] [GCC Program compilation]

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.