我想在原有的c++程序中加入数据库支持代码,因为要用到cdatabase,crecordset类,所以要在stdafx.h中加入afxdb.h,可是一加入就出现如下错误:
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>我的stdafx.h中有如下的头文件:
// Windows Header Files:
#include <windows.h>// C RunTime Header Files
#include <stdlib.h>
#include <malloc.h>
#include <memory.h>
#include <tchar.h>
#include <assert.h>我知道可能是头文件重复调用的缘故,可是到底该怎么做才能解决问题,请大家帮忙一下了,谢谢了先。
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>我的stdafx.h中有如下的头文件:
// Windows Header Files:
#include <windows.h>// C RunTime Header Files
#include <stdlib.h>
#include <malloc.h>
#include <memory.h>
#include <tchar.h>
#include <assert.h>我知道可能是头文件重复调用的缘故,可是到底该怎么做才能解决问题,请大家帮忙一下了,谢谢了先。
加在#ifdef 和 #endif 之间
你用MFC就不用#include <windows.h>这个了!
如果是重用你在里stdafx.h加了#include <windows.h>,别的地方就不要再#include <windows.h>,只要有#include "stdafx.h"就可以了!
是的,所以在afxdb.h的包括之前不能有windows.h
1. 所有".cpp"文件加入#include"stdafx.h"
2.你建的工程是console? 在工程设置中,点击link标签,底部:subsystem:后的console改成windows
good luck!
就是说afxdb.h必须在windows.h前被调用,才可以?还是说两者不能共存?