When developing with QT, there is no big problem when calling system API function in win7 and above systems. In XP, the phenomenon of Title Description appears, which makes it impossible to start the program. The solutions on the Internet are as follows:
Here I want to discuss some unfriendly errors in WinSDK v7.0. If you are a developer and are currently using WinSDK v7.0, which is included in the VS2010 compiler, when you execute a program, you can, You may encounter such an error prompt: the procedure entry point k32 * * could not be located in the dynamic link library Kernel32. DLL
the Chinese version is: unable to locate the program input point k32enumprocessmodules on the dynamic link library Kernel32. DLL. This kind of error prompt usually appears on the system other than Windows 7 or Windows Server 2008 R2
next, I’ll explain why such mistakes occur. Because of some performance problems, on Windows 7 and Windows Server 2008 R2 systems, Microsoft moved some API functions from psapi.dll to kernel32.dll dynamic library, and dealt with them on the version v7.0 of WinSDK that comes with VS2010 compiler. This design has no problem in Windows 7 and Windows Server 2008 R2 systems, but if you run the program compiled by VS2010 on the system before win7, you will definitely encounter the error just mentioned. Because the old system’s kernel32.dll does not have those functions that have been transplanted in the past, it will certainly fail to execute
the affected functions are as follows:
//Snapshot from Psapi.lib – WinSDK V7.0*
#if (PSAPI_ VERSION > 1)
#define EnumProcesses K32EnumProcesses
#define EnumProcessModules K32EnumProcessModules
#define EnumProcessModulesEx K32EnumProcessModulesEx
#define GetModuleBaseNameA K32GetModuleBaseNameA
#define GetModuleBaseNameW K32GetModuleBaseNameW
#define GetModuleFileNameExA K32GetModuleFileNameExA
#define GetModuleFileNameExW K32GetModuleFileNameExW
#define GetModuleInformation K32GetModuleInformation
#define EmptyWorkingSet K32EmptyWorkingSet
#define QueryWorkingSet K32QueryWorkingSet
#define QueryWorkingSetEx K32QueryWorkingSetEx
#define InitializeProcessForWsWatch K32InitializeProcessForWsWatch
#define GetWsChanges K32GetWsChanges
#define GetWsChangesEx K32GetWsChangesEx
#define GetMappedFileNameW K32GetMappedFileNameW
#define GetMappedFileNameA K32GetMappedFileNameA
#define EnumDeviceDrivers K32EnumDeviceDrivers
#define GetDeviceDriverBaseNameA K32GetDeviceDriverBaseNameA
#define GetDeviceDriverBaseNameW K32GetDeviceDriverBaseNameW
#define GetDeviceDriverFileNameA K32GetDeviceDriverFileNameA
#define GetDeviceDriverFileNameW K32GetDeviceDriverFileNameW
#define GetProcessMemoryInfo K32GetProcessMemoryInfo
#define GetPerformanceInfo K32GetPerformanceInfo
#define EnumPageFilesW K32EnumPageFilesW
#define EnumPageFilesA K32EnumPageFilesA
#define GetProcessImageFileNameA K32GetProcessImageFileNameA
#define GetProcessImageFileNameW K32GetProcessImageFileNameW
#endif
Copy code
Through the above explanation, you should understand why there is such a mistake, right?In general, I know how to correct this mistake. I don’t know if you have noticed that there is a conditional judgment # if (psapi)_ VERSION > 1) That is to say, only when psapi_ Version is defined as a value greater than 1, so the solution is to use psapi_ Version is defined as a value less than or equal to 1, as follows:
To add “include & lt; Psapi.h> Above
#ifndef PSAPI_ VERSION
#define PSAPI_ VERSION 1
#endif
#include < Tlhelp32.h>
#include < Psapi.h>
#pragma comment(lib, “Psapi.lib”)
At this point, the problem can be solved. Pay attention to the red font part. At the beginning, only the upper part is added. Compile the exception directly, and add the red part of the next line. Just started to set foot in QT, encountered problems can be solved online, the problem listed for their own reference
Similar Posts:
- LIBRARY_ Path and LD_ LIBRARY_ The difference of path environment variable
- How to Solve .NET 6 running on win7 SP1 error
- [Solved] VS winsock.h and ws2def.h a large number of redefined error
- GCC refers to math. H header file, and there are some errors such as undefined reference to ` POW ‘when compiling
- [Solved] Run-Time Check Failure #2 – Stack around the variable ‘a’ was corrupted
- The solution of waiting for dsmos “OSX”
- error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup
- [Solved] Undefined reference_G++ _GLIBCXX_USE_CXX11_ ABI compilation error: STD:: Basic_String and STD::__cxx11::basic_String cannot match
- [Solved] VS error C4996: ‘scanf’: This function or variable may be unsafe.
- C1189 #error: “No Target Architecture”