开发者

SHGetFolderPath': identifier not found

开发者 https://www.devze.com 2023-04-13 05:31 出处:网络
I am doing sample using DirectX 9 On Vs 2008/windows7. I am getting error. 1>------ Build started: Project: VideoCapture, Configuration: Debug Unicode Win32 ------

I am doing sample using DirectX 9 On Vs 2008/windows7. I am getting error.

1>------ Build started: Project: VideoCapture, Configuration: Debug Unicode Win32 ------ 1>Compiling...

1>VideoCaptureDlg.cpp

1>.\VideoCaptureDlg.cpp(169) : error C2065: 'SHGFP_TYPE_CURRENT' : undeclared identifier

1>.\VideoCaptureDlg.cpp(169) : error C3861: 'SHGetFolderPath': identifier not found

1>.\VideoCaptureDlg.cpp(173) : error C2065: 'SHGFP_TYPE_CURRENT' : undeclared identifier

1>.\VideoCaptureDlg.cpp(173) : error C3861: 'SHGetFolderPath': identifier not found

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' : undeclared identifier

1>.\VideoCaptureDlg.cpp(1180) : error C3861: 'SHGetFolderPath': identifier not found

1>.\VideoCaptureDlg.cpp(1184) : error C2065: 'SHGFP_TYPE_CURRENT' : undeclared identifier

1>.\VideoCaptureDlg.cpp(1184) : error C3861: 'SHGetFolderPath': identifier not found

I have added shlobj.h and shell32.lib as well still it is showing the same error.

I tried changing value of following macro in stdafx.h file based on Windows 7 and Internet Explorer 8 but it is showing conflict "C1189: #error : _WIN32_WINNT settings conflicts with _WIN32_IE setting"

// Refer to MSDN for the latest info on corresponding values for different platforms.

#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 // Al开发者_JS百科low 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

Any Suggestion for this Issue will be helpfull.


Is the code block from MSDN or your stdafx.h? I would just set the macros with no messing about with conditionals (you want to override previous settings). Also ensure you are setting them before any includes (especially windows.h).

Looking at where the error message comes from (line 263 of sdkddkver.h):

#if ((_WIN32_WINNT < _WIN32_WINNT_WIN2K) && (_WIN32_IE > _WIN32_IE_IE60SP1))
#error _WIN32_WINNT settings conflicts with _WIN32_IE setting
#endif

you are not setting these macros in the way you think you are.

EDIT (as per comments):

I would start my stdafx.h file (and ensure that is always the first header; this is needed for effective pre-compiled headers as well):

#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)


The Issue is resolved the problem. I just changed the Preprocessor setting under Project Properties--> c++->

Before it was
_WINDOWS;WINVER=0x0400;DEBUG;_DEBUG;_WIN32_WINNT=0x400;WIN32;UNICODE

I changed it to
_WINDOWS;WINVER=0x0600;DEBUG;_DEBUG;_WIN32_WINNT=0x600;WIN32;UNICODE

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号