dis*_*ney 6 c++ visual-studio-2008
我试图使用GetProcessImageFileName.我已经包含了Psapi.h但是当我尝试ti编译时我得到了
error LNK2019: unresolved external symbol _GetProcessImageFileNameA@12 referenced in function "bool __cdecl FindProcesses(char const *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *)" (?FindProcesses@@YA_NPBDPAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)99>G:\Test\main\Tests.exe : fatal error LNK1120: 1 unresolved externals
Run Code Online (Sandbox Code Playgroud)
该功能出现在Itellisense,所以任何人都可以告诉我为什么它不会编译?
这是一个链接器失败(它确实编译)并且与包含它无关Psapi.h.你可能需要链接Psapi.lib.
有关要链接的库的具体说明,请参阅参考页面中的" 库"部分GetProcessImageFileName():
Kernel32.lib on Windows 7 and Windows Server 2008 R2; Psapi.lib (if PSAPI_VERSION=1) on Windows 7 and Windows Server 2008 R2; Psapi.lib on Windows Server 2008, Windows Vista, Windows Server 2003, and Windows XP