我想加入ADO支持.在Stdafx.h中我加入如下代码:
#import "g:\program files\system\ado\msado15.dll" \no_namespace \
rename("EOF","adoEOF")
我用的是WINXP.VC++6.0
编译提示:
d:\c++\access\debug\msado15.tlh(407) : warning C4146: unary minus operator applied to unsigned type, result still unsigned
d:\c++\access\debug\msado15.tlh(407) : warning C4146: unary minus operator applied to unsigned type, result still unsigned Error executing cl.exe.
我应该如何解决呢?

解决方案 »

  1.   

    When you compile an ActiveX Data Objects (ADO) application in Visual C++ 6.0 using the #import directive with version 2.5 or 2.6 of Msado15.dll, you may receive the following warning: warning C4146: unary minus operator applied to unsigned type, result still unsigned RESOLUTION
    Although this problem will most likely have no effect on your application, you can suppress the warning with the following code: 
    #pragma warning(push)
    #pragma warning(disable:4146)
    #import "c:\program files\common files\system\ado\MSADO15.DLL" 
    #pragma warning(pop) 
    BUG: Using #import with ADO 2.5 and Later Causes C4146 Warning in Visual C++ Q253317
      

  2.   

    用#import指令引入ADO类型库
    我们在stdafx.h中加入如下语句:(stdafx.h这个文件哪里可以找到?你可以在FileView中的Header Files里找到)
    #import "c:\program files\common files\system\ado\msado15.dll" no_namespace rename("EOF","adoEOF")
    这一语句有何作用呢?其最终作用同我们熟悉的#include类似,编译的时候系统会为我们生成msado15.tlh,ado15.tli两个C++头文件来定义ADO库。几点说明:
    (1) 您的环境中msado15.dll不一定在这个目录下,请按实际情况修改
    (2) 在编译的时候肯能会出现如下警告,对此微软在MSDN中作了说明,并建议我们不要理会这个警告。
    msado15.tlh(405) : warning C4146: unary minus operator applied to unsigned type, result still unsigned 
      

  3.   

    这个警告不可有时候不可避免,微软给你的做法就是不管他。如果不想显示这个警告,就在代码里加:
    #pragma warning(disable:4146)  // 不显示4146号警告信息
      

  4.   

    msado15.tlh(405) : warning C4146: unary minus operator applied to unsigned type, result still unsigned 
    这个警告是微软得问题,^_^,不要管
      

  5.   

    不必理会
    加一句
    #pragma warning(disable:4146)
      

  6.   

    这个warning根本就没有任何影响
      

  7.   

    #pragma warning(disable:4146)
    这个东东对系统没有影响。
      

  8.   

    msado15.tlh(405) : warning C4146: unary minus operator applied to unsigned type, result still unsigned 
    这个警告是微软得问题,^_^,不要管
      

  9.   

    #pragma warning(disable:4146)
    //===========================
    告诉编译器忽略4146错误~