Visual C++ studio,仅重新编译修改过的文件
我有两个 dll 文件,由大约 1500 个 cpp 文件组成。当我需要编辑一个文件时,我通常会从头开始重新编译所有 1500 个文件。但我听说有一种方法可以让 Visual Studio 仅重新编译修改,从而花费更少的时间...我该怎么做?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
VS 实际上在进行依赖性检查方面非常出色,因此只重新编译必要的内容。我可以看到您所看到的情况的几个(或多或少可能)原因:
这就是我认为的概率递减顺序。
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:
That's in what I consider decreasing probability order.
选择修改后的文件,单击鼠标右键并编译,然后它只编译修改后的文件,然后构建它。与简单构建整个项目相比,它花费的时间更少。不确定 VS.net IDE 的新版本..我认为 VS.net IDE 只关心修改后的文件..如果您只运行“build”而不是“rebuild”
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"
在“项目属性”->“预编译头”选项中查找C/C++->预编译头菜单。将其设置为“使用”而不是“创建”。这对我有帮助。以下是我想在这里发布的原始消息:)
嗨。我在 VS 2010 上也有同样的问题。我已经运行了几次构建命令,所以所有项目都是最新的。我添加到一个包含空类的解决方案 .cpp 和 .h 文件。 .cpp 文件仅包含预编译头和 .h 文件,而 .h 文件仅包含 #pragma 一次和 'class test{};'。经过几次构建(4 个线程构建)后,我得到了所有最新消息。然后我将 .h 文件更改为“class test{int a};”并选择构建重建的所有文件后。
我还检查了最小重新编译选项并将其打开。可能是预编译头造成了麻烦。我现在检查一下:D
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