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!
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.
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.
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.
Build is the complete process of converting source code into an executable, for C++ compilation is the conversion of source code into object code.
"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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With