我正在使用 DirectX 9 在 Vs 2008/windows7 上做示例。 我收到错误消息。
1>------ 构建开始:项目:VideoCapture,配置:调试 Unicode Win32 ------ 1>编译...
1>VideoCaptureDlg.cpp
1>.\VideoCaptureDlg.cpp(169) : error C2065: 'SHGFP_TYPE_CURRENT' : 未声明的标识符
1>.\VideoCaptureDlg.cpp(169) : error C3861: 'SHGetFolderPath': 找不到标识符
1>.\VideoCaptureDlg.cpp(173) : error C2065: 'SHGFP_TYPE_CURRENT' : 未声明的标识符
1>.\VideoCaptureDlg.cpp(173) : error C3861: 'SHGetFolderPath': 找不到标识符
1>.\VideoCaptureDlg.cpp(1025) : warning C4244: 'argument' : conversion from 'int' to 'WORD', possible loss of data
1>.\VideoCaptureDlg.cpp(1180) : error C2065: 'SHGFP_TYPE_CURRENT' : 未声明的标识符
1>.\VideoCaptureDlg.cpp(1180) : error C3861: 'SHGetFolderPath': 找不到标识符
1>.\VideoCaptureDlg.cpp(1184) : error C2065: 'SHGFP_TYPE_CURRENT' : 未声明的标识符
1>.\VideoCaptureDlg.cpp(1184) : error C3861: 'SHGetFolderPath': 找不到标识符
我已经添加了 shlobj.h 和 shell32.lib,但它仍然显示相同的错误。
我尝试在基于 Windows 7 和 Internet Explorer 8 的 stdafx.h 文件中更改以下宏的值,但它显示冲突“C1189:#error:_WIN32_WINNT 设置与 _WIN32_IE 设置冲突”
//不同平台对应值的最新信息请引用MSDN。
#ifndef WINVER // Allow use of features specific to Windows XP or later.
#define WINVER 0x0501 // Change this to the appropriate value to target other versions of Windows.
#endif
#ifndef _WIN32_WINNT // Allow use of features specific to Windows XP or later.
#define _WIN32_WINNT 0x0601 // Change this to the appropriate value to target other versions of Windows.
#endif
#ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or later.
#define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later.
#endif
#ifndef _WIN32_IE // Allow use of features specific to IE 6.0 or later.
#define _WIN32_IE 0x0800 // Change this to the appropriate value to target other versions of IE.
#endif
对此问题的任何建议都会有所帮助。
最佳答案
代码块是来自 MSDN 还是您的 stdafx.h
?我只会设置宏而不用弄乱条件(你想覆盖以前的设置)。还要确保在任何包含之前设置它们(尤其是 windows.h
)。
查看报错信息出处(sdkddkver.h
第263行):
#if ((_WIN32_WINNT < _WIN32_WINNT_WIN2K) && (_WIN32_IE > _WIN32_IE_IE60SP1))
#error _WIN32_WINNT settings conflicts with _WIN32_IE setting
#endif
您没有按照您认为的方式设置这些宏。
编辑(根据评论):
我将开始我的stdafx.h
文件(并确保它是始终第一个 header ;这是有效预编译所必需的 header ):
#define WINVER 0x0601 // Kernel 6.1 == Windows 7/Server 2008 R2
#define _WIN32_WINNT WINVER
#define _WIN32_IE 0x0800 // IE8
#define NOMINMAX // Don't define min and max (prefer C++ lib)
关于c++ - SHGetFolderPath' : identifier not found,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7752404/