宏定义 _WIN32_WINNT=0x0400到底往哪加?
我最近做程序好几次用到要加#define _WIN32_WINNT 0x0400宏定义。我最先加在一个cpp文件的最开头,在所有include之上,网上很多也这么说,可是没有效果。网上还有说加到project->settings->c/c++ preprocessor definitions里:_WIN32_WINNT=0x0400。可是编译出错:
Command line warning D4024 : unrecognized source file type '_WIN32_WINNT=0x0400', object file assumed
Command line warning D4027 : source file '_WIN32_WINNT=0x0400' ignored
最后看到一篇文章说加到stdafx.h里,
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0400
#endif
#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
这次好了。
既然网上这么多人都提到前两种方法,那么他应该也管用,不知道大家怎么加?