What is the difference between compile code and executable code?

I always use the terms compile and build interchangeably.

What exactly do these terms stand for?


Solution 1:

Compiling is the act of turning source code into object code.

Linking is the act of combining object code with libraries into a raw executable.

Building is the sequence composed of compiling and linking, with possibly other tasks such as installer creation.

Many compilers handle the linking step automatically after compiling source code.

Solution 2:

From wikipedia:

In the field of computer software, the term software build refers either to the process of converting source code files into standalone software artifact(s) that can be run on a computer, or the result of doing so. One of the most important steps of a software build is the compilation process where source code files are converted into executable code.

While for simple programs the process consists of a single file being compiled, for complex software the source code may consist of many files and may be combined in different ways to produce many different versions.

Solution 3:

A build could be seen as a script, which comprises of many steps - the primary one of which would be to compile the code. Others could be

  • running tests
  • reporting (e.g. coverage)
  • static analysis
  • pre and post-build steps
  • running custom tools over certain files
  • creating installs
  • labelling them and deploying/copying them to a repository

Solution 4:

They often are used to mean the same thing. However, "build" may also mean the full process of compiling and linking a whole application (in the case of e.g. C and C++), or even more, including, among others

  • packaging
  • automatic (unit and/or integration) testing
  • installer generation
  • installation/deployment
  • documentation/site generation
  • report generation (e.g. test results, coverage).

There are systems like Maven, which generalize this with the concept of lifecycle, which consists of several stages, producing different artifacts, possibly using results and artifacts from previous stages.

Solution 5:

From my experience I would say that "compiling" refers to the conversion of one or several human-readable source files to byte code (object files in C) while "building" denominates the whole process of compiling, linking and whatever else needs to be done of an entire package or project.