Brief introduction to C / C + + project compilation tool

Time:2022-4-22

Based on the perspective of developers who need to compile and generate solutions for C language family projects, this paper briefly explains the terms of various tools needed in the compilation process.

GCC | llvm provides the compiler < — GNU make to compile according to the configuration file < — Autoconf | cmake to automatically generate the configuration file for compilation

Note: the various collections and tools mentioned above can do more than that.

GCC | LLVM

GCC and llvm are the two tool chains that we most often use when compiling c-series projects.

The full name of GCC is GNU compiler collection, that is, GNU compiler collection;

The full name of llvm is llvm (the abbreviation of low level virtual machine in the beginning, and now the meaning has changed). Now it is a general name of the compiler and tool chain collection of llvm.

GCC, full name GNU C compiler, is the C compiler in GCC;

G + +, full name GNU C + + compiler, is the C + + compiler in GCC.

Clang is the c-series compiler and tool chain in the front end of llvm collection. Clang is compatible with GCC. Clang appears later than GCC. Compared with GCC, clang has faster compilation speed and more friendly error prompts.

GNU Make

When the number of source files of the project is large and the structure is very complex, it will be very cumbersome to compile the project only with the compiler. It will be very cumbersome to refer to the header file directory, introduce the source file, introduce the third-party static library and dynamic library.

GNU make can select the appropriate source file in the project based on the compiler provided above to generate the intermediate target file and executable file required by the project. Developers guide GNU make to process and compile by writing a file called makefile.

Autoconf | CMake

Autoconf is an extension package for M4 macro processing. It can generate a script, which can automatically generate the configuration file for compilation. Autoconf and automake are a pair.

Cmake is an open source software. Developers guide the compilation process of the project by writing configuration files independent of the platform and compiler.

There are many concepts involved in Autoconf, the steps of generating scripts are cumbersome, and cmake is simpler to use.

Reference link

LLVM

GCC,the GNU Compiler Collection

GNU Make

diff between gcc and g++

Programming Languages Supported by GCC

Clang

CMake

Autoconf

The above is all the knowledge points introduced this time. I hope the contents sorted out by developeppaer can help you. If there are other steps, you can contact the Xiaobian below.