Visual C++ studio,仅重新编译修改过的文件

发布于 2024-08-07 03:53:12 字数 128 浏览 4 评论 0原文

我有两个 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

很酷又爱笑 2024-08-14 03:53:12

VS 实际上在进行依赖性检查方面非常出色,因此只重新编译必要的内容。我可以看到您所看到的情况的几个(或多或少可能)原因:

  • 您修改了标头,并且该标头已包含在各处。
  • 您点击的是“重建”而不是“构建”。
  • 您已包含一个 cpp 文件。
  • 您的项目、磁盘或日期有问题。

这就是我认为的概率递减顺序。

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.

怎樣才叫好 2024-08-14 03:53:12

选择修改后的文件,单击鼠标右键并编译,然后它只编译修改后的文件,然后构建它。与简单构建整个项目相比,它花费的时间更少。不确定 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"

苍白女子 2024-08-14 03:53:12

在“项目属性”->“预编译头”选项中查找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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文