resolve the maado15.dll

在VS2008项目下编译会出现大量错误

错误1:

ado2.h(45) : fatal error C1083: 无法打开类型库文件:“msado15.dll”: No such file or directory

解决方法:

//#import <msado15.dll> rename("EOF", "EndOfFile")
//#import <MSJRO.DLL> no_namespace rename("ReplicaTypeEnum", "_ReplicaTypeEnum")

#import "C:\Program Files\Common Files\System\ado\msado15.dll" rename("EOF", "EndOfFile")
#import "C:\Program Files\Common Files\System\ado\MSJRO.DLL" no_namespace rename("ReplicaTypeEnum", "_ReplicaTypeEnum")




错误2:


ado2.cpp(312) : error C2668: “pow”: 对重载函数的调用不明确

解决方法:

val /= pow(10, vtFld.decVal.scale);

val /= pow(10, (double)vtFld.decVal.scale);



错误3:

oledb2.h(38) : fatal error C1083: 无法打开类型库文件:“oledb32.dll”: No such file or directory

解决方法:

#import "C:\Program Files\Common Files\System\ole db\oledb32.dll" no_namespace
//#import <oledb32.dll> no_namespace



错误4:

oledb32.tlh(251) : error C2011: “IBindResource”: “struct”类型重定义

oledb32.tlh(289) : error C2011: “ICreateRow”: “struct”类型重定义

oledb32.tlh(329) : error C2011: “IRegisterProvider”: “struct”类型重定义

......

......

解决方法:

#import "C:\Program Files\Common Files\System\ole db\oledb32.dll" no_namespace

去掉红色部分



错误5:

oledb2.h(52) : error C2146: 语法错误 : 缺少“;”(在标识符“m_pDataLink”的前面)

oledb2.h(52) : error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int

oledb2.h(52) : error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int

oledb2.cpp(31) : error C2065: “m_pDataLink”: 未声明的标识符

oledb2.cpp(42) : error C2228: “.CreateInstance”的左边必须有类/结构/联合

......

......

解决方法:

手工加入命名空间名称,打开“oledb32.tlh”查找“namespace”关键字,内容为:

namespace MSDASC {

......

......

......

} // namespace MSDASC

红色部分自己手工加入

#import "C:\Program Files\Common Files\System\ole db\oledb32.dll" //no_namespace
using namespace MSDASC;



另外还有“#include "stdafx.h"“错误,这个自己决定是否加入或者去除,具体可在项目属性里设置

至此所有问题解决,编译通过 。。。。。。

原文地址:https://www.cnblogs.com/CBDoctor/p/2863498.html