MSDN中Enumerating All Processes枚举所有进程事例编译错误解析办法

 

MSDN中http://msdn.microsoft.com/en-us/library/ms682629(VS.85).aspx 枚举全部进程事例代码编译出现如下错误的原因及解决办法
Processes.obj : error LNK2019: unresolved external symbol _GetModuleBaseNameW@16 referenced in function "void __cdecl PrintProcessNameAndID(unsigned long)" (?PrintProcessNameAndID@@YAXK@Z)Processes.obj : error LNK2019: unresolved external symbol _EnumProcessModules@16 referenced in function "void __cdecl PrintProcessNameAndID(unsigned long)" (?PrintProcessNameAndID@@YAXK@Z)Processes.obj : error LNK2019: unresolved external symbol _EnumProcesses@12 referenced
解决办法:其实就是少了Psapi.lib库  添加进去就好了
You have to tell the linker to use Psapi.lib for those undefined functions.
I don't see any mention of which compiler and version you're using.
If you expect exact suggestions you will have to provide exact details.
VS2008进行如下操作、相信VS2005也是一样的
For VC++ 2008 you can add Psapi.lib to the list of files used as input by the
linker by drilling down into the Project Properties to Configuration Properties,
Linker, Input and then adding Psapi.lib to the "Additional Dependencies".

posted @ 2009-02-15 18:08  eping  阅读(685)  评论(0编辑  收藏  举报