MFC ADO 数据库连接

本文解决MSADO15.tlh文件中关于枚举类型的重复定义错误,并指导如何通过导入DLL和调整预处理器定义来优化解决方案。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

..\msado15.tlh(171)error C2011: 'LockTypeEnum' : 'enum' type redefinition
..\msado15.tlh(214) : error C2011: 'DataTypeEnum' : 'enum' type redefinition
..\msado15.tlh(258) : error C2011: 'FieldAttributeEnum' : 'enum' type redefinition
..\msado15.tlh(279) : error C2011: 'EditModeEnum' : 'enum' type redefinition
..\msado15.tlh(287) : error C2011: 'RecordStatusEnum' : 'enum' type redefinition
..\msado15.tlh(407) : warning C4146: unary minus operator applied to unsigned type, result still unsigned

..\msado15.tlh(531) : error C2011: 'ParameterDirectionEnum' : 'enum' type redefinition


解决方法:

 1复制以下代码到stdafx.h 

 #import "C:\Program Files\Common Files\System\ado\msado15.dll" \
no_namespace rename("EOF", "adoEOF")rename("BOF","adoBOF")


2将 宏 _AFX_NO_DAO_SUPPORT 添加到setting->c/c++(category下拉框选中 preprocessor)->preprocessor definitions 的最后即可

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值