I try to understand what is the difference between the 2 built types in visual studio (Build vs Rebuild Solution). As i know when i use precompiled headers the simple built will not complile the precompiled headers as long the code in these files remain the same, but 'rebuilt' will compile them always. So what happend when i don't use precompiled headers? I notice that simple built is still faster than rebuilt, what exactly does to reduce the compling time (c )?
CodePudding user response:
Using Build will typcally only rebuild the files that needs to be rebuilt because of changes you've made to the code.
If you create two files in your project/solution, a.cpp and b.cpp, and then Build the first time, both will be compiled (into a.obj and b.obj) and then linked into an .exe file.
If you then make changes to a.cpp only and select Build again, only a.cpp would be compiled (into a a.obj) and that a.obj and the already existing b.obj would be linked into an .exe file.
If you instead select Rebuild, b.cpp would also be recompiled before linking, even though you didn't make any changes to b.cpp.
