我建立了一个regular dll 但是在导入#import 
"c:\program files\common files\system\ado\msado15.dll" \
no_namespace \
rename("EOF", "adoEOF")
后确提示出错error C2011: 'LockTypeEnum' : 'enum' type redefinition
f:\source\vc\query\debug\msado15.tlh(214) : error C2011: 'DataTypeEnum' : 'enum' type redefinition
f:\source\vc\query\debug\msado15.tlh(258) : error C2011: 'FieldAttributeEnum' : 'enum' type redefinition
f:\source\vc\query\debug\msado15.tlh(279) : error C2011: 'EditModeEnum' : 'enum' type redefinition
f:\source\vc\query\debug\msado15.tlh(287) : error C2011: 'RecordStatusEnum' : 'enum' type redefinition
f:\source\vc\query\debug\msado15.tlh(407) : warning C4146: unary minus operator applied to unsigned type, result still unsigned
f:\source\vc\query\debug\msado15.tlh(531) : error C2011: 'ParameterDirectionEnum' : 'enum' type redefinition
Error executing cl.exe.这是怎么回事啊?

解决方案 »

  1.   

    DLL中的ADO! 
    内容:在stdafx中加入
    #import "C:\Program Files\Common Files\System\ADO\msado15.dll" no_namespace rename("EOF","adoEOF")后总是编译通不过,说是有EditModeEnum、RecordStatusEnum、ParameterDirectionEnum、LockTypeEnum、DataTypeEnum、FieldAttributeEnum重定义!改成
    #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; 后错误都没有了前两天刚解决了