在Visual C ++中替换#import [英] Replacement for #import in Visual C++

查看:182
本文介绍了在Visual C ++中替换#import的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个大的C ++项目,我们用/ MP开关编译以利用多个内核。



但是,我们最近引入了一些代码, #import在几个tlb的,和#import是不兼容/ MP,这意味着我们回到单线程构建和更多的时间来获得咖啡。



任何建议如何让#import和/ MP玩好吗?是否有一个工具将静态生成从#import作为预构建步骤的C ++头?



更新:



按照Matt的建议工作非常好。对于任何在Google中绊倒此人的人:


  1. 创建单独的静态库项目

  2. 足够包括所以你可以把 #import 语句放在lib项目

  3. 使你的主项目依赖于lib项目正确的构建顺序)

  4. 将lib项目的临时构建文件夹添加到主项目的包含路径

  5. #include 生成的 .tlh 文件,您正在执行 #import

  6. 启用 / MP 开关并丢失休息时间...


#include 从 #import 创建的生成的标题 $ 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:

  1. create a separate static lib project
  2. set up enough includes so you can put the #import statement in the lib project
  3. make your main project dependent on the lib project (to ensure correct build order)
  4. add the lib project's temporary build folder to the include path for the main project
  5. #include the generated .tlh files where you were doing the #import
  6. enable the /MP switch and lose the coffee break time...

解决方案

Why not just #include the generated headers created from #import?

这篇关于在Visual C ++中替换#import的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆