您的位置:首页 > 其它

关于Error 1 error C1189: #error : "include 'stdafx.h' before including this file这个错误的解决方法

2013-04-04 12:19 726 查看
关于Error 1 error C1189: #error : "include 'stdafx.h' before including this file这个错误的解决方法

如果该错误出现在a.dll中但是单独编译a.dll没有问题,当把a.dll包含到要使用它的工程b里时,再编译包含它的工程时就出现了该错误。

当如上所述时,只要在工程b中的stdafx.h文件中加入如下代码:就可以了。

#pragma once

#define _AFXDLL

#include "targetver.h"

#include <stdio.h>

#include <tchar.h>

// TODO: reference additional headers your program requires here

// stdafx.h : include file for standard system include files,

// or project specific include files that are used frequently, but

// are changed infrequently

#ifndef VC_EXTRALEAN

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

#endif

#include "targetver.h"

#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit

#include <afxwin.h> // MFC core and standard components

#include <afxext.h> // MFC extensions

#ifndef _AFX_NO_OLE_SUPPORT

#include <afxole.h> // MFC OLE classes

#include <afxodlgs.h> // MFC OLE dialog classes

#include <afxdisp.h> // MFC Automation classes

#endif // _AFX_NO_OLE_SUPPORT

#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

#ifndef _AFX_NO_OLE_SUPPORT

#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls

#endif

#ifndef _AFX_NO_AFXCMN_SUPPORT

#include <afxcmn.h> // MFC support for Windows Common Controls

#endif // _AFX_NO_AFXCMN_SUPPORT

#include <afxcontrolbars.h>

/*

// stdafx.h : include file for standard system include files,

// or project specific include files that are used frequently, but

// are changed infrequently

#pragma once

#ifndef VC_EXTRALEAN

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

#endif

#include "targetver.h"

#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit

#include <afxwin.h> // MFC core and standard components

#include <afxext.h> // MFC extensions

#ifndef _AFX_NO_OLE_SUPPORT

#include <afxole.h> // MFC OLE classes

#include <afxodlgs.h> // MFC OLE dialog classes

#include <afxdisp.h> // MFC Automation classes

#endif // _AFX_NO_OLE_SUPPORT

#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

#ifndef _AFX_NO_OLE_SUPPORT

#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls

#endif

#ifndef _AFX_NO_AFXCMN_SUPPORT

#include <afxcmn.h> // MFC support for Windows Common Controls

#endif // _AFX_NO_AFXCMN_SUPPORT

*/
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐