导入msado15.dll后未生成msado15.tlh

时间:2017-02-04 03:35:50

标签: c++ visual-studio-2013

我尝试使用/MP (Build with Multiple Processes)选项启用多进程编译,但是它与#import冲突,所以我尝试了Replacement for #import in Visual C++中提出的解决方法:< / p>

对于其他在google中绊倒的人:

  1. 创建一个单独的静态lib项目
  2. 设置足够的包含,以便您可以将#import语句放在lib项目中
  3. 使您的主项目依赖于lib项目(以确保正确的构建顺序)
  4. 将lib项目的临时构建文件夹添加到包含路径中 主要项目
  5. #include生成的.tlh文件,您正在执行#import
  6. 启用/ MP开关并失去咖啡休息时间......
  7. 然而,我愚弄了这些步骤,&#34; msado15.tlh&#34;没有生成。

    这就是我的所作所为:

    1. 创建一个静态库项目AdoImport
    2. AddImport.h项目中添加标题文件AdoImport,只包含一行:#import "C:/Program Files/Common Files/System/ado/msado15.dll" rename("EOF", "adoEOF") rename("BOF", "adoBOF")
    3. 编译
    4. 我希望在msado15.tlhAdoImport文件夹中生成Debug,但找不到它。编译报告成功,仅生成AdoImport.lib

      如何生成msado15.tlh以便我的主项目可以包含它?

3 个答案:

答案 0 :(得分:1)

以防万一有人点击谷歌,我是如何解决的 -

将行func rightViewTapped(_ gesture: UITapGestureRecognizer) { print("rightViewTapped") } 放在#import "C:/Program Files/Common Files/System/ado/msado15.dll" rename("EOF", "adoEOF") rename("BOF", "adoBOF")项目的stdafx.h中,以便始终进行编译。

AdoImport项目的“中间目录”(在项目属性 - &gt;配置属性 - &gt;常规下)应包含在主项目的路径中。

答案 1 :(得分:1)

Thanks for providing the solution. Going by this I tried to create the same in VS2015, but somehow not worked.

So I added the import statement

#import "C:/Program Files/Common Files/System/ado/msado15.dll" rename("EOF", "adoEOF") rename("BOF", "adoBOF")

in my Main Project's Precompiled Header File StdAfx.h and compiled the StdAfx.cpp and soon after that the #import error stating "..cannot open msado15.tlh" is resolved. This is simple work around without any need to create the Library. But you answer led me to resolve this. Thanks to you.

Thanks, Kamleshwar.

答案 2 :(得分:1)

在VS2019中获得了相同的错误消息,但是原因不同。 .tlh文件的目标文件夹是只读的。我取消选中该文件夹上的只读。 VS创建了tlh,错误消息消失了。

相关问题