51

What's the difference between Building and Compiling.

1

4 Answers 4

49

Compiling is part of a build process.

A build process can include testing, packaging and other activities apart from compilation.

29

"Building" is a fairly general term, and it can refer to anything that is needed to go from editable source material (source code, scripts, raw data files, etc.) to a shippable software product. Building can (and usually does) involve several steps, such as pre-processing, compiling, linking, converting data files, running automated tests, packaging, etc.

"Compiling" is more specific, and almost invariably refers to a process that takes source code as its input, and outputs something runnable, typically machine code for either a physical or virtual machine, or source code in a different language.

14

These terms are often used interchangeably, but I would differentiate them in the following way:

  • Building is done when preparing an application for release, which includes compiling, packaging, testing, etc.
  • Compiling is done at any time the compiler is involved in translating programming language code to machine code.

Thus, compiling is really a subset of building.

4
  • 1
    "Building is done when preparing an application for release" - don't tell that the continous integration crowd ;) Or any other avid user of automatic builds, for that matter.
    – user7043
    Mar 18, 2012 at 18:53
  • 1
    @delnan: Agreed. Continuous integration creates many "builds" over the lifetime of an application. However, any or all of these builds could be used in preparation for a public release. It depends on your build, test and approval processes.
    – Bernard
    Mar 18, 2012 at 18:58
  • 3
    Well, according to the continous delivery crowd, each of these builds should be ready for release. But practice says otherwise, and generally "builds" may serve any purpose that is aided by getting the software ready to run and testing it. Debug builds, for instance. Or checking that your changes didn't break any of the 16 million tests.
    – user7043
    Mar 18, 2012 at 19:00
  • 2
    @delnan - What about a build that fails its tests? By the standards of the continuous delivery crowed, it is a build but not ready for release :)
    – Oded
    Mar 18, 2012 at 19:05
3

Compiling is done by compiler, build can be more complex process.

Eg. in C++ to make a build of a project you need preprocessor (preprocessing of source files); compiler (compiling of source files); linker (merging everything into executable - compiled code, icons, strings, other resources together)

So generally compiling is translating code written in one language to another (eg. machine code).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.