在用#import语句加入Ado15.dll编译时报错WINDOWS.H already included,什么原因 ,急,解决立马结账

zhangxg001 2003-08-24 11:10:15
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 : . MFC apps must not #include <windows.h>
Error executing cl.exe.
这是什么意思,怎么解决
...全文
108 14 打赏 收藏 转发到动态 举报
写回复
用AI写文章
14 条回复
切换为时间正序
请发表友善的回复…
发表回复
bluebohe 2003-11-20
  • 打赏
  • 举报
回复
楼主问题应该解决掉了吧
fengge8ylf 2003-10-08
  • 打赏
  • 举报
回复
up
dreamchild 2003-10-08
  • 打赏
  • 举报
回复
放在STDAFX.H文件的最后边就没问题了。
不要放在stdafx.h原有语句的前边。因为编译是按顺序的。
andyhn 2003-10-08
  • 打赏
  • 举报
回复
同意try1225(xyz) ( )
我今天也碰到相同的问题,
确实是位置的问题
照try1225(xyz) ( ) 的做法就解决了
显刚 2003-09-05
  • 打赏
  • 举报
回复
应该是重复引用的问题
在StdAfx.h中如果有下面这一段
/*
#ifndef _AFX_NO_DB_SUPPORT
#include <afxdb.h> // MFC ODBC database classes
#endif // _AFX_NO_DB_SUPPORT

#ifndef _AFX_NO_DAO_SUPPORT
#include <afxdao.h> // MFC DAO database classes
#endif // _AFX_NO_DAO_SUPPORT
*/
就注释掉
这样就没问题了
njtu 2003-09-04
  • 打赏
  • 举报
回复
#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;

如果你include了windows.h,去掉他看看
try1225 2003-09-04
  • 打赏
  • 举报
回复
可能是你在stdafx.h中引入#import 的位置不对,我也碰到过类似的问题,下面是stdafx.h的所有内容,你按这样试一试:

// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//

#if !defined(AFX_STDAFX_H__94AF60A9_BD38_4D19_98DE_F90F0D080E3D__INCLUDED_)
#define AFX_STDAFX_H__94AF60A9_BD38_4D19_98DE_F90F0D080E3D__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers

#include <afxwin.h> // MFC core and standard components
#include <afxext.h> // MFC extensions
#include <afxdisp.h> // MFC Automation classes
#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h> // MFC support for Windows Common Controls
#endif // _AFX_NO_AFXCMN_SUPPORT

//#import的引入位置
#import "C:\Program Files\Common Files\System\ado\msado15.dll" \
no_namespace \
rename("EOF","adoEOF")

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_STDAFX_H__94AF60A9_BD38_4D19_98DE_F90F0D080E3D__INCLUDED_)
iketeng 2003-09-04
  • 打赏
  • 举报
回复
把你的IMPORT语句放在下面这块之后就OK了!

#include <afxwin.h> // MFC core and standard components
#include <afxext.h> // MFC extensions
#include <afxdisp.h> // MFC Automation classes
#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h> // MFC support for Windows Common Controls
#endif // _AFX_NO_AFXCMN_SUPPORT

birdzxy 2003-09-04
  • 打赏
  • 举报
回复
我怀疑你是在动态连接库里引用的,呵呵不知道是不是啊,不过也随便说一下,如果是的话
去掉#include <afxdao.h>(在STDAFX。H里)
ZHENG017 2003-09-04
  • 打赏
  • 举报
回复
#import "msado15.tlb" ...
zhangxg001 2003-08-24
  • 打赏
  • 举报
回复
如何解决,能讲清楚一点吗,我不是很熟悉这一块
alfred13 2003-08-24
  • 打赏
  • 举报
回复
Fatal Error C1189
#error : user supplied error message

This error message is generated when there is an #error directive in the program. For example:

#undef _WIN32

#if !defined(_WIN32)
#error _WIN32 must be defined //error
#endif

int main() {
return 0;
}
alfred13 2003-08-24
  • 打赏
  • 举报
回复
Compiler Warning (level 3) C4146
unary minus operator applied to unsigned type, result still unsigned

The variable should be cast to a signed type if it must contain a signed value. Its type is still unsigned.

The following example causes this warning:

void func()
{
unsigned int ui;
-ui; // warning

commandconque 2003-08-24
  • 打赏
  • 举报
回复
你在所有的include 预处理文件之后加入import 语句试试

4,011

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 数据库
社区管理员
  • 数据库
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧