What is the difference between make and gcc?

前端 未结 11 1315
小鲜肉
小鲜肉 2021-01-31 02:39

The last sentence in the article caught my eye

[F]or C/C++ developers and students interested in learning to program in C/C++ rather than users of L

11条回答
  •  遥遥无期
    2021-01-31 03:32

    gcc compiles and/or links a single file. It supports multiple languages, but does not knows how to combine several source files into a non-trivial, running program - you will usually need at least two invocations of gcc (compile and link) to create even the simplest of programs.

    Wikipedia page on GCC describes it as a "compiler system":

    The GNU Compiler Collection (usually shortened to GCC) is a compiler system produced by the GNU Project supporting various programming languages.

    make is a "build tool" that invokes the compiler (which could be gcc) in a particular sequence to compile multiple sources and link them together. It also tracks dependencies between various source files and object files that result from compilation of sources and does only the operations on components that have changed since last build.

    GNUmake is one popular implementation of make. The description from GNUmake is as follows:

    Make is a tool which controls the generation of executables and other non-source files of a program from the program's source files.

    Make gets its knowledge of how to build your program from a file called the makefile, which lists each of the non-source files and how to compute it from other files.

提交回复
热议问题