Click here to Skip to main content
15,868,035 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
VS2010 C++ Project gets compiled completely for every minor changes that i make in the source file. Is there any setting in the VS2010 to avoid it.

Sajith
Posted

I doubt this is what actually happens, unless you artificially forced the MSBuild to do so, somehow.

More likely that all items just "mentioned" in output, but actually MSBuild system just considers time stamps and dependencies on existing build artifacts and actually skips actual compilation and/or linking steps for many items.

The remaining build steps still can be considerable if you seemingly "minor" changes invalidate a pretty big subset of project/solution items. Imaging that you declare one tiny interface which is used by most compilation units and all projects in your solution. And than you add a tiny change to the file declaring this interface. Of course, if will force most items to be rebuilt.

Do the following: add a little change in one file which sits on the very top of dependency graph. Build solution incrementally and save the output to some file. After that perform full re-build and also save the output. Compare two outputs to see that the volume of full re-build is much more.

—SA
 
Share this answer
 
No, changes don't magically make their way into an executable, the program has to be recompiled so that your changes are converted into machine code and put in the right place.

There are a couple "incremental compilers" out there, but its really not a well supported concept.
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 20-Nov-13 22:42pm    
Wait a second. Who is talking about "incremental compilers"?

The incremental build concept is really well supported, but at the level of separate compilation. OP (or you?) just did not notice that. The simple experiment I suggested will show that the compilation units not invalidated by a change in a file not breaking the dependencies won't be recompiled. Even if you have interface in one file, and its implementation in another file, and implementation is changed, the dependent file won't be recompiled, but new implementation will be re-linked.

Even in C/C++. Of course, its archaic and dumb "#include" mechanism strongly spoils separate compilation and incremental build, but even this problem is considerably alleviated with the use of "pre-compiled headers"...

—SA
Ron Beyer 20-Nov-13 22:49pm    
I figured the OP wasn't talking about anything complicated like dependent projects or referenced DLL's, I figured that he was talking about having a simple program (like a Win32 console) and making a change (Hello World to Hello USA) and not wanting to do a full build. Thats where the incremental compiler came in... Maybe I didn't read into it enough.
gssajith87 20-Nov-13 23:06pm    
But i dont see, if the change i make sits on top of all compilation units. I have modified same file same line before and it have just compiled as desired., but yesterday i got this problem for every changes i make i am getting to compile the entire solution.

What i doubt is, if i had changed VS2010 Settings, that is forcing this full compilation. Is there a possible project propery setting that will cause this problem. ??

For now, i have created a new solution and have started working on it and not sure, if the same will happen to the new one as well.
Ron Beyer 20-Nov-13 23:09pm    
Make sure you have the "Minimal Build" compiler option set.
Sergey Alexandrovich Kryukov 20-Nov-13 23:24pm    
Ah, good point...
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900