Visual Studio 如何确定 IDL 文件的编译顺序?

发布于 2024-09-09 16:36:25 字数 207 浏览 5 评论 0原文

我有一个 COM 项目,其中包含许多 IDL 文件,其中一些文件被导入到其他文件中。 Visual Studio 如何决定首先编译哪些(使用 MIDL)?

我想控制顺序。我有一个主 IDL 文件,其中包含带有多个导入的库声明,如果它不是第一个编译的文件,我会收到构建错误。

(如果这听起来真的很奇怪......我是 COM/ATL 的新手,这真的非常非常令人困惑)。

I have a COM project that contains a number of IDL files, some of which are imported into other ones. How does Visual Studio decide which ones to compile (using MIDL) first?

I want to control the order. I have a master IDL file which contains my library declaration with several imports, and I get a build error if it is not the first one compiled.

(If any of this sounds really weird... I'm new to COM/ATL, and it's really, really confusing).

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(2

⒈起吃苦の倖褔 2024-09-16 16:36:25

您不能要求 Visual Studio 按特定顺序生成 .ild 文件。相反,您可以将一些 .idl 文件#include 到其他 .idl 文件中,并将导入的文件设置为“从构建中排除”。这样,MIDL 不会单独编译导入的文件,而是将其内容包含到另一个文件的特定位置,并作为该文件的一部分进行编译(与 C 预处理器 #include 效果相同)。

You can't ask Visual Studio to build .ild files in a specific order. Instead you can #include some of .idl files into other .idl files and set the files you imported to "excluded from build". This way MIDL will not compile the imported files separately, instead it will include their contents into specific place of another file and compile as the part of that file (same effect as with C preprocesor #include).

青衫负雪 2024-09-16 16:36:25

您可以让 Visual Studio 按照您想要的任何顺序构建内容,有两种方法可以做到这一点:

  1. 放入预构建步骤,您可以在其中构建您希望首先构建的内容。

  2. 将您想要首先构建的项目放在一个单独的项目中,然后通过使您的另一个项目依赖于它来首先构建该项目。

如果您无法修改 idl 文件,您应该这样做。然而,如果一个 idl 文件确实依赖于另一个文件并且您可以修改它们,那么请执行上面建议的操作并让一个文件包含另一个文件。

You can make Visual Studio build things in any order you want, there are 2 ways to do this:

  1. Put in a pre-build step in which you can get it to build the ones you wish to build first.

  2. Put the ones you want to build first in a separate project and get it to build that project first by making your other one dependent on it.

This is what you should do if you cannot modify the idl files. If however one idl file really does depend on another and you can modify them, then do what was suggested above and get one to include the other.

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