2010-07-15 3 views
1

우리는 VS2008에서 VS2010으로 애플리케이션을 이전하려고합니다.MIDL 컴파일 오류 (및 아마도 idl 파일 생성 질문)

"속성이있는 프로그래밍"으로 일부 COM 개체가 생성되고 IDL이 자동으로 생성됩니다.

두 파일의 가져 오기 명령이 다르며 VS2010에서 컴파일이 실패합니다. 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 

수동 제거 다음과 같은 오류가 발생

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"; 

에 : VS2008에

, 그것은 뭔가를 생성 "wincrypt.idl"import 지시문은 컴파일 오류를 제거하지만 솔루션 sinc가 아닙니다. idl이 자동으로 생성됩니다.

두 IDL이 다른 이유와 가져 오기 지시문을 추가해야하는 이유는 확실하지 않습니다. 심지어는 MIDL 컴파일 오류를 수정하는 방법도 있습니다.

아이디어가 있으십니까?

미리 감사드립니다.

최대

답변

3

그것은 당신이 당신의 코드에서 [importidl] 속성을 사용하여 문제를 해결할 수

#import "ocidl.idl" 

없습니다.

원인 프로그래밍은 약간의 실수 였지만 VS2008에서 ATL 프로젝트 마법사의 옵션으로 제거되었을 때 필수적으로 사용되지 않게되었습니다. 코드 기반을 장기간 유지하려면 제거하는 것이 좋습니다. 시작할 때 자동으로 생성 된 .idl을 사용할 수 있습니다.

1

아마도 [importidl] 속성을 잘못 사용하고 있었지만이 문제를 해결하기 위해 한스의 답변을 얻을 수 없었습니다. 그러나 수정 here 수정. stdafx.h 파일 맨 위에 추가하십시오 :

[idl_quote("import \"ocidl.idl\";")];