‘SetDefaultDllDirectories’ : ‘`global namespace” のメンバーではありません。 エラー
DirectShow関係のプログラムを行なっていて、以下のようなエラーが出た。
エラー 3 error C2039: ‘SetDefaultDllDirectories’ : ‘`global namespace” のメンバーではありません。
名前から推測するとデフォルトDLLディレクトリをセットする関数のよう。
MSDNのページで調べてみると、Windows.hがincludeされているといけるみたいなことが、書いてある。
が、
さらに記述を見てみると、
「None on Windows 7, Windows Server 2008 R2, Windows Vista, and Windows Server 2008」
とかいてある。えー、Windows7じゃだめなの?と思い、別の箇所をみるとしっかりWindows8からと書いてあった。
しかたが無いのでエラーがでているソース atlcore.hを見ると、以下のような記述。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
#include <stdio.h> #ifndef _USING_V110_SDK71_ // the LOAD_LIBRARY_SEARCH_SYSTEM32 flag for LoadLibraryExW is only supported if the DLL-preload fixes are installed, so // use LoadLibraryExW only if SetDefaultDllDirectories is available (only on Win8, or with KB2533623 on Vista and Win7)... IFDYNAMICGETCACHEDFUNCTION(L"kernel32.dll", SetDefaultDllDirectories, pfSetDefaultDllDirectories) { return(::LoadLibraryExW(pszLibrary, NULL, LOAD_LIBRARY_SEARCH_SYSTEM32)); } // ...otherwise fall back to using LoadLibrary from the SYSTEM32 folder explicitly. #endif WCHAR wszLoadPath[MAX_PATH+1]; UINT rc = ::GetSystemDirectoryW(wszLoadPath, _countof(wszLoadPath)); if (rc == 0 || rc >= _countof(wszLoadPath)) { return NULL; } |
ということで、確かにいま使っているのはWindowsSDKの7.1なので、_USING_V110_SDK71_を定義してみたらエラーは出なくなりました。