我們正在研究將我們的應用程序從VS2008移到VS2010。MIDL編譯錯誤(也可能是idl文件生成問題)
我們使用「屬性編程」生成一些COM對象,並自動生成IDL。
這兩個文件的導入指令都不同,編譯在VS2010上失敗。
在VS2008,它會產生類似:
import "docobj.idl";
在VS 2010
import "C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\wincrypt.idl";
import "C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\exdisp.idl";
import "C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\shldisp.idl";
import "C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\prsht.idl";
import "C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\mshtmhst.idl";
import "C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\mshtml.idl";
import "c:\program files (x86)\microsoft sdks\windows\v7.0a\include\dimm.idl";
import "c:\program files (x86)\microsoft sdks\windows\v7.0a\include\dispex.idl";
當IDL是在VS2010編譯它產生以下錯誤
20> Microsoft (R) 32b/64b MIDL Compiler Version 7.00.0555
20> Copyright (c) Microsoft Corporation. All rights reserved.
20> Processing .\_my_idl.idl
20> _my_idl.idl
20> Processing C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\wincrypt.idl
20> wincrypt.idl
20>C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\wincrypt.idl(47): error MIDL2025: syntax error : expecting a type specification or a storage specifer or a type qualifier near "WCHAR"
20>C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\wincrypt.idl(47): error MIDL2026: cannot recover from earlier syntax errors; aborting compilation
20>LINK : fatal error LNK1240: failed to compile IDL content
手動刪除「wincrypt.idl」導入指令消除了編譯錯誤,但這不是一個解決方案e idl是自動生成的。
我不確定爲什麼兩個IDL是不同的,什麼是負責添加導入指令;甚至如何解決MIDL編譯錯誤。
任何想法?
在此先感謝。
最大。