我按书上写的,打开StdAfx.h文件,添加对ADO的支持代码:
#import "C:\\Program Files\\Common Files\\System\\ADO\\msado15.dll"
  no_namespace rename("EOF","EndOfFile")
编译时为什么会出错?
错误指示:
StdAfx.cpp
e:\章国怀\e1302\debug\msado15.tlh(409) : warning C4146: unary minus operator applied to unsigned type, result still unsigned
e:\章国怀\e1302\stdafx.h(17) : error C2146: syntax error : missing ';' before identifier 'rename'
e:\章国怀\e1302\stdafx.h(17) : error C2501: 'no_namespace' : missing storage-class or type specifiers
e:\章国怀\e1302\stdafx.h(17) : fatal error C1004: unexpected end of file found
哪位能帮忙哪里错了,难道是添加的头文件里面的位置错了?

解决方案 »

  1.   

    #import "C:\Program Files\Common Files\System\ADO\msado15.dll" \
        no_namespace rename("EOF", "EndOfFile")
      

  2.   

    stdafx.h最后一行必须是空行,你把光标移到最后回个车
      

  3.   

    按你说的之后变成一个错误了。错误如下,是为什么啊
    : warning C4146: unary minus operator applied to unsigned type, result still unsigned
    c:\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>
      

  4.   

    按你说的之后变成一个错误了。错误如下,是为什么啊
    : warning C4146: unary minus operator applied to unsigned type, result still unsigned
    c:\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>
      

  5.   

    让你不要显示#include <windows.h>