Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio - How to refrain from compiling all project files every build?

Each time I build my Visual C++ solution in Visual Studio 2010, the entire project (not the entire solution) recompiles.

There must be a flag or configuration somewhere to make VS compile only the changed files + depending files. Where is it?

UPDATES:

  • I set "Yes (/Gm)" to My project's configuration properties\C/C++\Code Generation\Enable Minimal Rebuild. It still compiles all the project's files upon F7.
like image 939
Jonathan Livni Avatar asked Dec 21 '10 20:12

Jonathan Livni


People also ask

What is the difference between build rebuild and clean in Visual Studio?

To build, rebuild, or clean an entire solution Choose Build All to compile the files and components within the project that have changed since the most recent build. Choose Rebuild All to "clean" the solution and then builds all project files and components. Choose Clean All to delete any intermediate and output files.

Is rebuild the same as clean and build?

For a multi-project solution, "rebuild solution" does a "clean" followed by a "build" for each project (possibly in parallel). Whereas a "clean solution" followed by a "build solution" first cleans all projects (possibly in parallel) and then builds all projects (possibly in parallel).


1 Answers

If in addition you get the a message similar to:

Creating ".\Release\SomeLib.unsuccessfulbuild" because "AlwaysCreate" was specified.

when building, the reason might be that one of your projects refers to a header file which does not exist on disk (see here and here).

The first link also includes a small C# script to check for this situation. To fix, simply remove the reference to the non-existing header files from your project.

Update

It might be possible that you have your precompiled-headers setting on 'Create'. To fix, right-click your project in the solution browser and select: properties -> C/C++ -> Precompiled Headers -> Precompiled Header. Change the setting from Create to Use or Not Using Precompiled Headers.

like image 148
bavaza Avatar answered Sep 22 '22 13:09

bavaza