The difference between gcc, g ++, make, cmake's

  First, some GCC: GNU Compiler Collection (GNU Compiler Collection), when developing applications for Linux, are used in most cases C language, the most important issue facing nearly every Linux programmer is how flexible use of the C compiler. Currently Linux, the most commonly used C language compiler is GCC (GNU Compiler Collection), which is the GNU project build system in line with ANSI C standard, the program can be compiled with C, C ++ and Object C and other languages. GCC is not only very powerful, very flexible structure. The most noteworthy point is that it can support a variety of languages ​​through different front-end modules, such as Java, Fortran, Pascal, Modula-3, and so on Ada.

the difference gcc g ++:    
gcc GCC is the GUNC Compiler (C compiler)

g ++ is the GCC GUN C ++ Compiler (C ++ compiler)

More accurate to say that: gcc called Ccompiler, and called g ++ C ++ compiler

gcc and g ++ main difference

1. For * .c and * .cpp files, gcc and cpp files were compiled as c (c strength and cpp syntax is not the same); g ++ compiler is unified as cpp file

2. When using the g ++ compiler files, g ++ will automatically link the standard library STL, and gcc does not automatically link STL, when compiled with gcc c ++ file, in order to be able to use the STL, need to add parameters -lstdc ++, but that does not mean gcc - and g ++ equivalents lstdc ++

3.gcc when compiling C files, predefined macros that can be used is relatively small

4.gcc when compiling cpp file / g ++ when you compile c file and cpp files (this time called gcc and g ++ compilers are cpp file), will add some additional macros are as follows:

#define__GXX_WEAK__ 1
#define __cplusplus 1
#define __DEPRECATED 1
#define __GNUG__ 4
#define __EXCEPTIONS 1

#define __private_extern__ extern

gcc / g ++ and differences make:
when your program has only one source file, it can be directly compiled with gcc command. But when your program contains a number of source files, one by one to compile with gcc command, you can easily confused and heavy workload.

So there are a make tools! make tools can be seen as an intelligent batch tool itself does not compile and link functions, but with a similar batch mode - by calling the makefile user-specified command to compile and link.

What makefile that? Simply put, the music is like a song, make tools like the conductor, music conductor according to the command of the entire orchestra how to play, make tools to compile and link according to the makefile command. makefile command contains the call to gcc (also may be other compiler) to compile an order from a source file.

make the difference cmake:
makefile in a few simple projects completely artificial hands, but when the project is very large, handwritten makefile is very troublesome, if it was a platform makefile have to re-edit.

At this time there have been Cmake this tool, cmake will be easier to generate the makefile above that make use. Cmake course, there are other features, cross-platform that can generate the corresponding platform usable makefile, you do not have to modify themselves.

But according to what cmake generate makefile it? It again called CMakeLists.txt according to a file (scientific name: configuration file) to generate a makefile.
---------------------
Author: hblhly
Source: CSDN
Original: https: //blog.csdn.net/hblhly/article/details/80740493
Disclaimer: This article as a blogger original article, reproduced, please attach Bowen link!

Guess you like

Origin www.cnblogs.com/shaonianpi/p/10964190.html
Recommended