在Visual C ++中替换#import [英] Replacement for #import in Visual C++
问题描述
我们有一个大的C ++项目,我们用/ MP开关编译以利用多个内核。
但是,我们最近引入了一些代码, #import在几个tlb的,和#import是不兼容/ MP,这意味着我们回到单线程构建和更多的时间来获得咖啡。
任何建议如何让#import和/ MP玩好吗?是否有一个工具将静态生成从#import作为预构建步骤的C ++头?
更新:
按照Matt的建议工作非常好。对于任何在Google中绊倒此人的人:
- 创建单独的静态库项目
- 足够包括所以你可以把
#import
语句放在lib项目 - 使你的主项目依赖于lib项目正确的构建顺序)
- 将lib项目的临时构建文件夹添加到主项目的包含路径
-
#include
生成的.tlh
文件,您正在执行#import
- 启用
/ MP
开关并丢失休息时间...
#import $ c>创建的生成的标题 $ c>?
We have large C++ project that we used to compile with the /MP switch to take advantage of multiple cores.
However, we recently brought in some code that uses #import on a couple of tlb's, and #import is incompatibile with /MP, which means we are back to single threaded builds and a lot more time to get coffee.
Any suggestions on how to get #import and /MP to play nice? Is there a tool that will statically generate the C++ headers from a #import as a pre-build step?
Update:
Following Matt's advice worked great. For anyone else stumbling over this in google:
- create a separate static lib project
- set up enough includes so you can put the
#import
statement in the lib project
- make your main project dependent on the lib project (to ensure correct build order)
- add the lib project's temporary build folder to the include path for the main project
#include
the generated .tlh
files where you were doing the #import
- enable the
/MP
switch and lose the coffee break time...
解决方案 Why not just #include
the generated headers created from #import
?
这篇关于在Visual C ++中替换#import的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!