错误 C2039:“SetDefaultDllDirectories":不是全局命名空间的成员

2022-01-12 00:00:00 mfc

xxxvcatlmfcincludeatlcore.h(638):错误 C2039:SetDefaultDllDirectories":不是全局命名空间"的成员

xxxvcatlmfcincludeatlcore.h(638): error C2039: "SetDefaultDllDirectories": is not a member of "global namespace"

#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));
    }
#endif

里面的功能都是VS没有实现的
那么我该如何解决这个问题呢?
libray有什么问题吗?我在VS2012中运行这个程序

the functions in it are all not realized by VS
so how do I solve this problem?
is there something wrong with the libray?I run this program in VS2012

推荐答案

您必须确保在您的项目属性中定义了_USING_V110_SDK71_".Visual Studio 会自动为您定义.它通常不会显示",因为未勾选从父级或项目默认值继承".

You have to make sure "_USING_V110_SDK71_" is defined in your project properties. Visual Studio automatically defines this for you. It normally doesn't "show up" because "Inherit from parent or project defaults" is un-ticked.

从旧的 atl 项目升级时,我发现这种情况很常见,因为某些原因,stdafx.cpp 未勾选从父级或项目默认值继承".

I've found this common when upgrade from old atl projects that the stdafx.cpp has "Inherit from parent or project defaults" un-ticked for some reason.

您应该检查项目设置以及单个 stdafx.cpp 文件设置,以确定在预处理器定义中选中了从父级或项目默认值继承"复选框.在某些情况下,会检查项目文件的预处理器定义对话框,但不会检查特定 stdafx.cpp 文件的预处理器定义对话框.

You should check both the project settings as well as the individual stdafx.cpp file settings to determine that in the Preprocessor Definitions the "Inherit from parent or project defaults" check box is checked. In some cases the Preprocessor Definitions dialog of the Project file is checked however the Preprocessor Definitions dialog of the specific stdafx.cpp file is NOT checked.

相关文章