vc下error C2011: 'DataTypeEnum' : 'enum' type redefinition解决方法

1>------ 已启动生成: 项目:sutest, 配置: Debug Win32 ------
1>正在编译...
1>sutest.cpp
1>f:/c++ pro/iocptser/debug/msado15.tlh(228) : error C2011: “LockTypeEnum”: “enum”类型重定义
1>        c:/program files/microsoft sdks/windows/v6.0a/include/dbdaoint.h(109) : 参见“LockTypeEnum”的声明
1>f:/c++ pro/iocptser/debug/msado15.tlh(276) : error C2011: “DataTypeEnum”: “enum”类型重定义
1>        c:/program files/microsoft sdks/windows/v6.0a/include/dbdaoint.h(138) : 参见“DataTypeEnum”的声明
1>f:/c++ pro/iocptser/debug/msado15.tlh(321) : error C2011: “FieldAttributeEnum”: “enum”类型重定义
1>        c:/program files/microsoft sdks/windows/v6.0a/include/dbdaoint.h(127) : 参见“FieldAttributeEnum”的声明
1>f:/c++ pro/iocptser/debug/msado15.tlh(343) : error C2011: “EditModeEnum”: “enum”类型重定义
1>        c:/program files/microsoft sdks/windows/v6.0a/include/dbdaoint.h(83) : 参见“EditModeEnum”的声明
1>f:/c++ pro/iocptser/debug/msado15.tlh(352) : error C2011: “RecordStatusEnum”: “enum”类型重定义
1>        c:/program files/microsoft sdks/windows/v6.0a/include/dbdaoint.h(341) : 参见“RecordStatusEnum”的声明
1>f:/c++ pro/iocptser/debug/msado15.tlh(616) : error C2011: “ParameterDirectionEnum”: “enum”类型重定义
1>        c:/program files/microsoft sdks/windows/v6.0a/include/dbdaoint.h(326) : 参见“ParameterDirectionEnum”的声明
1>f:/c++ pro/iocptser/iocptser.cpp(18) : error C2871: “ADODB”: 具有该名称的命名空间不存在
1>生成日志保存在“file://f:/C++ pro/iocptser/Debug/BuildLog.htm”
1>iocptser - 7 个错误,0 个警告
========== 生成: 成功 0 个,失败 1 个,最新 0 个,跳过 0 个 ==========


后来经过在csdn上的搜索发现有下面两种办法来解决这个问题

1)

#pragma warning(disable:4146)
#import "C:/Program Files/Common Files/System/ADO/msado15.dll" named_guids rename("EOF","adoEOF"), rename("BOF","adoBOF")
#pragma warning(default:4146)
using namespace ADODB;

2)

#pragma warning(disable:4146)
#import "C:/Program Files/Common Files/System/ado/msado15.dll" /
no_namespace /
rename("EOF","adoEOF") rename("DataTypeEnum","adoDataTypeEnum") /
rename("FieldAttributeEnum", "adoFielAttributeEnum") rename("EditModeEnum", "adoEditModeEnum") /
rename("LockTypeEnum", "adoLockTypeEnum") rename("RecordStatusEnum", "adoRecordStatusEnum") /
rename("ParameterDirectionEnum", "adoParameterDirectionEnum")

你可能感兴趣的:(编程)