Upgrade Issue: Compile error C2327 with import dll under VC8/VS2005

Issue:
When I upgrade an exe project from VC7.1 to VC8, it says upgrade
succeed. But When I try to compile the project, it outputs a lot of errors.
 
../debug/msado15.tlh(1024) : error C2327: 'CDO::_ADO::Properties' : is not a type name, static, or enumerator
../debug/msado15.tlh(2086) : error C2327: 'CDO::Command15::Parameters' : is not a type name, static, or enumerator
../debug/msado15.tlh(2285) : error C2327: 'CDO::Connection15::Errors' : is not a type name, static, or enumerator
../debug/msado15.tlh(2525) : error C2327: 'CDO::Recordset15::Fields' : is not a type name, static, or enumerator
../debug/msado15.tlh(3124) : error C2327: 'CDO::_Record::Fields' : is not a type name, static, or enumerator
../debug/msado15.tli(109) : error C2065: '_result' : undeclared identifier
../debug/cdosys.tlh(628) : error C2327: 'CDO::IConfiguration::Fields' : is not a type name, static, or enumerator
../debug/cdosys.tlh(814) : error C2327: 'CDO::IBodyPart::Fields' : is not a type name, static, or enumerator
../debug/cdosys.tlh(1090) : error C2327: 'CDO::IMessage::Fields' : is not a type name, static, or enumerator
../debug/cdosys.tlh(1100) : error C2327: 'CDO::IMessage::Fields' : is not a type name, static, or enumerator
 
In my project, the import sentences are written like follows:
 
#include "stdafx.h"
#include "Resource.h"
#include "ProcessorThread.h"
#include <string>
#import "c:/program files/common files/system/ado/msado15.dll"
rename("ADODB","CDO") rename( "EOF", "adoEOF" )
#import <cdosys.dll>
 
 
Root Reason:
The msado15.tlh and cdosys.tlh are not generated correctly. When I compare the .tlh file generated by 2003 and 2005, I noticed the keyword “struct” is missed in some method definitions in the tlh file generated by 2005.
For example: in msado15.tlh
virtual HRESULT __stdcall get_Item (
        /*[in]*/ VARIANT Index,
        /*[out,retval]*/ struct Property * * ppvObject ) = 0; // this struct is missed in the tlh generated under VS2005
 
virtual HRESULT __stdcall get_Item (
        /*[in]*/ VARIANT Index,
        /*[out,retval]*/ struct Error * * ppvObject ) = 0;  // this struct is missed in the tlh generated under VS2005
 
           
The generation of tlh files is affected by some codes in this project, which is compiled earlier than the import sentences.
 
Solution:
Move the import sentences to the very beginning of stdafx.h. Maybe move to other positions could also make things work. The only thing I did is to make the import sentences compiled earlier than other sentences, by moving their position.
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值