求助
我在机器上安装了Visual Studio 2010中文旗舰版,在Visual Studio 2010下打开CxImgLib.dsw,由系统自动将Visual C++ 6.0的*.dsw格式自动转换为Visual Studio 2010的*.sln格式。转换完成后开始编译解决方案中的Demo项目,但是出现了一些错误,错误描述如下:
1> StdAfx.cpp
1>d:\program files\microsoft visual studio 10.0\vc\atlmfc\include\atlcore.h(35): fatal error C1189: #error : This file requires _WIN32_WINNT to be #defined at least to 0x0403. Value 0x0501 or higher is recommended.
从google搜索找出答案http://connect.microsoft.com/VisualStudio/feedback/details/455721/cant-compile-due-to-issues-with-preprocessor-constants,将Demo项目中 StdAfx.h 头文件中的如下部分:
C/C++ code
#ifndef WINVER
#define WINVER 0x0400
#endif
替换为
C/C++ code
// Modify the following defines if you have to target a platform prior to the ones specified below.
// Refer to MSDN for the latest info on corresponding values for different platforms.
#ifndef WINVER // Allow use of features specific to Windows 95 and Windows NT 4 or later.
#define WINVER 0x0501 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later.
#endif
#ifndef _WIN32_WINNT // Allow use of features specific to Windows NT 4 or later.
#define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later.
#endif
#ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or later.
#define _WIN32_WINDOWS 0x0501 // Change this to the appropriate value to target Windows Me or later.
#endif
#ifndef _WIN32_IE // Allow use of features specific to IE 4.0 or later.
#define _WIN32_IE 0x0500 // Change this to the appropriate value to target IE 5.0 or later.
#endif
重新编译Demo,又出现如下编译错误:
1>------ 已启动生成: 项目: demo, 配置: Unicode Debug Win32 ------
1> StdAfx.cpp
1>d:\program files\microsoft visual studio 10.0\vc\atlmfc\include\afxcmn3.inl(20): error C2065: “CCM_SETWINDOWTHEME”: 未声明的标识符
1>d:\program files\microsoft visual studio 10.0\vc\atlmfc\include\afxcmn3.inl(23): error C2065: “CCM_SETWINDOWTHEME”: 未声明的标识符
1>d:\program files\microsoft visual studio 10.0\vc\atlmfc\include\afxcmn3.inl(29): error C2065: “CCM_SETWINDOWTHEME”: 未声明的标识符
1>d:\program files\microsoft visual studio 10.0\vc\atlmfc\include\afxcmn3.inl(46): error C2065: “CCM_SETWINDOWTHEME”: 未声明的标识符
========== 生成: 成功 0 个,失败 1 个,最新 9 个,跳过 0 个 ==========
在网上找了很长时间,始终找不到这个编译错误的解决办法。