首先应该在 stdafx.h 中删除windows.h的引用
添加如下引用:
#define VC_EXTRALEAN
#include <afxwin.h>
#include <afxext.h>
#include <afxdisp.h>
#include <afxdtctl.h>
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h>
#endif
然后在工程属性中的mfc使用选择 在静态库中使用mfc 或者 在动态dll中使用mfc