在vc中的regular dll中使用ado的导入问题
2004-08-30 14:44
423 查看
这一段时间要用到dll中使用ado,在mfc中用ado一段时间没有出现什么问题,本以为在dll中也不会出现什么问题,但是问题产生了,而且是在最开始的导入ado的dll文件时候。我的做法是:
#import "c:/program files/common files/system/ado/msado15.dll" no_namespace rename("EOF","adoEOF")
出现:
Compiling resources...
Compiling...
StdAfx.cpp
F:/source/vc/Query/debug/msado15.tlh(169) : error C2011: 'LockTypeEnum' : 'enum' type redefinition
F:/source/vc/Query/debug/msado15.tlh(212) : error C2011: 'DataTypeEnum' : 'enum' type redefinition
F:/source/vc/Query/debug/msado15.tlh(256) : error C2011: 'FieldAttributeEnum' : 'enum' type redefinition
F:/source/vc/Query/debug/msado15.tlh(277) : error C2011: 'EditModeEnum' : 'enum' type redefinition
F:/source/vc/Query/debug/msado15.tlh(285) : error C2011: 'RecordStatusEnum' : 'enum' type redefinition
F:/source/vc/Query/debug/msado15.tlh(405) : warning C4146: unary minus operator applied to unsigned type, result still unsigned
F:/source/vc/Query/debug/msado15.tlh(527) : error C2011: 'ParameterDirectionEnum' : 'enum' type redefinition
Error executing cl.exe.
ADIDllTest.dll - 6 error(s), 1 warning(s)
后来经过在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")
相对来说,还是第一种方法显得更加简便。
希望以后遇到类似问题的朋友可以给你们一些帮助
#import "c:/program files/common files/system/ado/msado15.dll" no_namespace rename("EOF","adoEOF")
出现:
Compiling resources...
Compiling...
StdAfx.cpp
F:/source/vc/Query/debug/msado15.tlh(169) : error C2011: 'LockTypeEnum' : 'enum' type redefinition
F:/source/vc/Query/debug/msado15.tlh(212) : error C2011: 'DataTypeEnum' : 'enum' type redefinition
F:/source/vc/Query/debug/msado15.tlh(256) : error C2011: 'FieldAttributeEnum' : 'enum' type redefinition
F:/source/vc/Query/debug/msado15.tlh(277) : error C2011: 'EditModeEnum' : 'enum' type redefinition
F:/source/vc/Query/debug/msado15.tlh(285) : error C2011: 'RecordStatusEnum' : 'enum' type redefinition
F:/source/vc/Query/debug/msado15.tlh(405) : warning C4146: unary minus operator applied to unsigned type, result still unsigned
F:/source/vc/Query/debug/msado15.tlh(527) : error C2011: 'ParameterDirectionEnum' : 'enum' type redefinition
Error executing cl.exe.
ADIDllTest.dll - 6 error(s), 1 warning(s)
后来经过在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")
相对来说,还是第一种方法显得更加简便。
希望以后遇到类似问题的朋友可以给你们一些帮助
相关文章推荐
- 在vc中的MFC regular dll中使用ado的导入问题
- 在vc中的regular dll中使用ado的导入问题
- VC6中使用VC2005编译的DLL问题
- 关于在英创em9161板上使用ADO.net连接远程数据库提示 “无法找到 PInvoke dll"dbnetlib.dll"”问题解决方法
- (原创)VB调用DLL(VC)使用结构体参数时的内存对齐及分配的问题.
- VC++中使用ADO访问Oracle遇到的问题及解决方法(待续)
- 使用 .DLL .LIB 的问题(针对VC)
- VC++中DLL(动态链接库)使用的若干问题
- VC 在DLL中使用全局变量出现异常问题
- 外部DLL文件在C#中导入使用问题
- VC中使用Matlab Engine出现"无法找到libeng.dll"的问题
- DLL在跨平台之间的使用中遇到的问题(以delphi中开发的dll,在vc中使用为例)
- VC中使用Matlab Engine出现"无法找到libeng.dll"的问题
- VC 使用ADO连接数据库的问题!error C2059: 语法错误 : “”
- VC6中使用VC2005编译的DLL问题
- VC 使用ADO连接数据库的问题!error C2059: 语法错误 : “<L_TYPE_raw>”
- vc使用ado连接数据库WIN7平台问题
- 关于使用vc++调用matlab生成的dll传递数组的问题
- 在DLL中使用ADO连接数据库的问题
- 难道这又是个未解之谜?--- 关于DLL中使用ADODATASET出错的问题