Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Build or compile

I have a theoretical question about the difference between compile and build. I'm programming in a c++ project that takes a lot of time to build, so I have told to do build just in the cases in where "I have modified any header file". Is that true? If I add a new attribute in a headder file, then do I have to build? Is not enough compiling?

Thanks!

like image 557
Frion3L Avatar asked Mar 04 '13 09:03

Frion3L


People also ask

Is compile same as build?

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.

Does compile mean run?

Compile time is the period when the programming code (such as C#, Java, C, Python) is converted to the machine code (i.e. binary code). Runtime is the period of time when a program is running and generally occurs after compile time.

What is the difference between build and compile in terms of program execution?

The difference between build and compile is that build is the process of compiling and linking a program, while compile is the process of translating a program written in a high-level programming language to machine code. In simple words we can say that Build is a compiled version of a program.

Is building the same as compiling C++?

Build is the complete process of converting source code into an executable, for C++ compilation is the conversion of source code into object code.


1 Answers

"Building" is a vague term that usually means the entire process, preprocessing, compiling and linking. Which parts of these processes have to be redone after a source change depends on what has changed. If you only changed a single .cpp source, it's enough to recompile it and link the objects again. If you change a .h header, all source files that include this header have to be recompiled, which is usually expensive as project-specific headers tend to be included in many source files.

In short, if you have made a change to the source, all files affected by this have to be recompiled and the entire binary has to be re-linked.

like image 169
us2012 Avatar answered Oct 17 '22 05:10

us2012