Vista 操作系统中未找到入口点错误

2022-01-11 00:00:00 operating-system c++

我在 VS2010 中有一个 C++ 项目,并在 VS2013 中升级它.我正在使用win7操作系统,它工作正常.输出是一个 exe 文件,我试图在 Vista OS 中运行这个可执行文件,但它崩溃并显示错误消息无法在动态链接库 KERNEL32.dll 中找到过程入口点 K32EnumProcessModules"我该如何解决这个问题?

I have a C++ project in VS2010 and upgrade it in VS2013. I am using win7 os and it is working fine. The out put is an exe file and I tried to run this executable in Vista OS but it crashed with showing an error message as "The procedure entry point K32EnumProcessModules could not be located in the dynamic link lybrary KERNEL32.dll" How can I fix this issue?

推荐答案

查看文档 EnumProcessModules 具体这部分:

See the documentation for EnumProcessModules specifically this part:

必须在早期版本的 Windows 以及 Windows 7 和更高版本上运行的程序应始终将此函数称为 EnumProcessModules.为确保正确解析符号,请将 Psapi.lib 添加到 TARGETLIBS 宏并使用 -DPSAPI_VERSION=1 编译程序.要使用运行时动态链接,请加载 Psapi.dll.

Programs that must run on earlier versions of Windows as well as Windows 7 and later versions should always call this function as EnumProcessModules. To ensure correct resolution of symbols, add Psapi.lib to the TARGETLIBS macro and compile the program with -DPSAPI_VERSION=1. To use run-time dynamic linking, load Psapi.dll.

这基本上意味着:

在你的代码中使用 EnumProcessModules

链接到 Psapi.lib

PSAPI_VERSION=1 设置为预处理器定义

Set up PSAPI_VERSION=1 as a preprocessor definition

相关文章