문제

우리는 VS2008에서 VS2010으로 응용 프로그램을 옮기고 있습니다.

"adtributed programming"이있는 일부 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";
.

VS2010에서 IDL을 컴파일 할 때 다음 오류를 생성합니다

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"가져 오기 지시문을 제거하면 컴파일 오류가 제거되지만 IDL이 자동 생성되기 때문에 솔루션이 아닙니다.

두 개의 IDL이 다른 이유가 있고 가져 오기 지시문을 추가하는 것이 무엇인지 확실하지 않습니다.또는 MIDL 컴파일 오류를 수정하는 방법조차도.

아이디어가 있습니까?

미리 감사드립니다.

최대.

도움이 되었습니까?

해결책

가 누락되었습니다.
 #import "ocidl.idl"
.

코드의 [importIdl] 속성을 사용하여 해결할 수 있습니다.

기타 Programming은 약간의 실수였습니다. VS2008의 ATL 프로젝트 마법사 옵션으로 제거되었을 때 본질적으로 사용되지 않습니다.장기간의 코드 기반의 유지 보수는이를 제거하는 것이 좋습니다.자동 생성 된 .IDL을 시작하여 시작하여 시작할 수 있습니다.

다른 팁

Perhaps I was using the [importidl] attribute wrong, but I couldn't get Hans' answer to fix this problem. But the fix here worked. Just add this to the top of your stdafx.h file:

[idl_quote("import \"ocidl.idl\";")];
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top