c ++ compiler link library

Learning from gcc / G ++ compilers and link libraries

c ++ compiler is divided into four stages

  1. Precompiled
  2. Compile
  3. compilation
  4. link

Precompiled

Precompiled was originally part c ++ compiler, and its job is to program content before compiling some of the most trade-off process, making some statements compiled participate, while others do not participate in compiling statements.
Commonly used pre-compiler directive is:

 1、包含指令:#include
 2、条件指令:#if、#elif、#else、#endif、#ifdef、#ifndef
 3、定义指令:#define、#undef
  1. Header file will contain expanded to include the program file

  2. The role of conditional compilation directive is to direct and coordinate multiple choice program statement header files
    , such as when you upgrade gcc version, and the need to meet the old version of the compiler, you can use conditional compilation
#if defined(__GNUC__) && (__GNUC__ >= 3 )
	//balabala
#else
	//balabala other
  1. Definition instruction can be used to prevent the same file include a plurality of times
    at this stage for preprocessing the file extension is C .i, after treatment c ++ file suffix .ii

from c ++ precompiled

Compile

The main stages of compiling lexical analysis and parsing through the c ++ code is translated into assembly code
at this stage will .s .i files into file

compilation

As the name suggests is a compilation of language translation will be compiled into machine instructions
will .s files into .o files

link

Static link library

Dynamic Link Library

Guess you like

Origin www.cnblogs.com/humeay/p/12547647.html