如何用MIDL对earth.idl文件生成头文件和库文件

penfe 2009-01-08 04:27:50
我想用MIDL对earth.idl文件生成需要头文件和库文件供C++ project使用。

1. 我把earth.idl include到项目中来,rebuild project,生成了earth_h.h,earth_i.c,earth_p.c和dlldata.c四个文件。
2. 然后exclude earth.idl文件,include earth_h.h,earth_i.c文件。
3. Rebuld project,结果出现.\earth_i.c : fatal error C1853: 'Release\GoogleEarthAPISample.pch' precompiled header file is from a previous version of the compiler, or the precompiled header is C++ and you are using it from C (or vice versa)
4. 在项目里关掉了Use Precompiled Header 后,编译通过。也可以用哪些接口了。

但是我看见Google上有人用MIDL生成的是头文件和库文件,请问有人知道怎么别让MIDL生成.c文件,而是生成库文件或者是.cpp文件?这样我就不用关掉Use Precompiled Header ,是吧?
...全文
490 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
guoln1010 2011-05-25
  • 打赏
  • 举报
回复
具体怎么操作?MIDL在哪呢?
SweeeetyQ 2010-08-17
  • 打赏
  • 举报
回复
学习一下
nodiebirdcomeback 2009-01-11
  • 打赏
  • 举报
回复
midl earth.idl
oyljerry 2009-01-09
  • 打赏
  • 举报
回复
[Quote=引用楼主 penfe 的帖子:]
我想用MIDL对earth.idl文件生成需要头文件和库文件供C++ project使用。

1. 我把earth.idl include到项目中来,rebuild project,生成了earth_h.h,earth_i.c,earth_p.c和dlldata.c四个文件。
2. 然后exclude earth.idl文件,include earth_h.h,earth_i.c文件。
3. Rebuld project,结果出现.\earth_i.c : fatal error C1853: 'Release\GoogleEarthAPISample.pch' precompiled header file is from a previous version of …
[/Quote]
默认就是生成.c文件,通用做法就是去掉预编译,所以你follow这个规则好了
zhangzb717 2009-01-09
  • 打赏
  • 举报
回复
不知道,只能帮你顶了
  • 打赏
  • 举报
回复
你可以关掉.c这个文件的Use Precompiled Header

或者改一下扩展名 然后在最前面增加上#include "stdafx.h"
jameshooo 2009-01-08
  • 打赏
  • 举报
回复
不知道你是怎么用的

3,245

社区成员

发帖
与我相关
我的任务
社区描述
ATL,Active Template Library活动(动态)模板库,是一种微软程序库,支持利用C++语言编写ASP代码以及其它ActiveX程序。
社区管理员
  • ATL/ActiveX/COM社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧