我新建了一个MFC静态链接库,然后在stdafx.h头文件中加入
#import "c:\program files\common files\system\ado\msado15.dll"\
no_namespace \
rename("EOF","adoEOF")
编译出现错误如下:e:\实验\sll\release\msado15.tlh(171) : error C2011: 'LockTypeEnum' : 'enum' type redefinition
e:\实验\sll\release\msado15.tlh(214) : error C2011: 'DataTypeEnum' : 'enum' type redefinition
e:\实验\sll\release\msado15.tlh(258) : error C2011: 'FieldAttributeEnum' : 'enum' type redefinition
e:\实验\sll\release\msado15.tlh(279) : error C2011: 'EditModeEnum' : 'enum' type redefinition
e:\实验\sll\release\msado15.tlh(287) : error C2011: 'RecordStatusEnum' : 'enum' type redefinition
e:\实验\sll\release\msado15.tlh(407) : warning C4146: unary minus operator applied to unsigned type, result still unsigned
e:\实验\sll\release\msado15.tlh(531) : error C2011: 'ParameterDirectionEnum' : 'enum' type redefinition
执行 cl.exe 时出错.
这是为什么??
#import "c:\program files\common files\system\ado\msado15.dll"\
no_namespace \
rename("EOF","adoEOF")
编译出现错误如下:e:\实验\sll\release\msado15.tlh(171) : error C2011: 'LockTypeEnum' : 'enum' type redefinition
e:\实验\sll\release\msado15.tlh(214) : error C2011: 'DataTypeEnum' : 'enum' type redefinition
e:\实验\sll\release\msado15.tlh(258) : error C2011: 'FieldAttributeEnum' : 'enum' type redefinition
e:\实验\sll\release\msado15.tlh(279) : error C2011: 'EditModeEnum' : 'enum' type redefinition
e:\实验\sll\release\msado15.tlh(287) : error C2011: 'RecordStatusEnum' : 'enum' type redefinition
e:\实验\sll\release\msado15.tlh(407) : warning C4146: unary minus operator applied to unsigned type, result still unsigned
e:\实验\sll\release\msado15.tlh(531) : error C2011: 'ParameterDirectionEnum' : 'enum' type redefinition
执行 cl.exe 时出错.
这是为什么??
肯定是你的com和本程序中有重定义那些ENUM吧
no_namespace \
rename("EOF","adoEOF")
注意前面两行, 行末的\之后不能有空格
#import "c:\program files\common files\system\ado\msado15.dll"\
居然是那个错而不是 illagle escape sequence xxxx #import "c:\\program files\\common files\\system\\ado\\msado15.dll" \
第二种方法是 #import "d:\Program Files\Common Files\SYSTEM\ADO\msado15.dll" \
no_namespace \
rename ("EOF", "adoEOF") \
rename ("LockTypeEnum", "adoLockTypeEnum") \
rename ("DataTypeEnum", "adoDataTypeEnum") \
rename ("FieldAttributeEnum", "adoFieldAttributeEnum") \
rename ("EditModeEnum", "adoEditModeEnum") \
rename ("RecordStatusEnum", "adoRecordStatusEnum") \
rename ("ParameterDirectionEnum", "adoParameterDirectionEnum")
在一种是引起#include <adoint.h>
我今天也遇到了这个问题,试了好几种方法,采用了最后一种方法解决了,但不太清楚原因。希望高手指教
Compiling...
StdAfx.cpp
e:\2study\myprojects\chartopinyin\debug\msado15.tlh(407) : warning C4146: unary minus operator applied to unsigned type, result still unsigned
d:\program files\microsoft visual studio\vc98\mfc\include\afxv_w32.h(14) : fatal error C1189: #error : WINDOWS.H already included. MFC apps must not #include <windows.h>
执行 cl.exe 时出错.
Creating browse info file...
BSCMAKE: error BK1506 : cannot open file '.\Debug\StdAfx.sbr': No such file or directory
执行 bscmake.exe 时出错.CharToPinyin.exe - 1 error(s), 0 warning(s)