Visual C++ studio, recompiling only the modified files
开发者_开发技巧I have two dll files made by around 1500 cpp files. When I need to edit one, I usually then recompile all the 1500 files from the start. But I heard there is a way to make Visual Studio recompile the modifies only, taking a lot less time... How do I do this?
VS is actually pretty good in doing the dependency checks so that only necessary stuff is re-compiled. I can see a couple of (more or less likely) reasons for what you're seeing:
- You modify a header and that's been included everywhere.
- You're hitting "rebuild" instead of "build".
- You have included a cpp file.
- Something's fishy with your projects, your disk, or your date.
That's in what I consider decreasing probability order.
Select the modified files, right mouse click and compile then it compiles only modified files and then build it.. it takes less time compare to simply build the whole project. Not sure about new versions of VS.net IDE.. I think VS.net IDE take cares only the modified files.. if you run "build" only not "rebuild"
Look for Precompiled Header option in Projects Properties -> C/C++ -> Precompiled Headers menu. Set it to Use instead of Create. That helped me. Below is my original message which i wanted to post here :)
Hi. I too have same problem with VS 2010. I have run build command few times so all projects are up to date. I added to one solution .cpp and .h file containing empty class. .cpp file contained only precompiled header and .h file, while .h file only #pragma once and 'class test{};'. After few builds (4 thread building) i get all up to date message. Then i changed .h file to 'class test{int a};' and after selecting build all files where rebuilt.
Also i checked for minimal recompile option and its turned on. Probably is precompiled header causing trouble. Ill check it now :D
精彩评论