Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/visual-studio-2008/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ GetProcessImageFileName未链接_C++_Visual Studio 2008 - Fatal编程技术网

C++ GetProcessImageFileName未链接

C++ GetProcessImageFileName未链接,c++,visual-studio-2008,C++,Visual Studio 2008,我正在尝试使用GetProcessImageFileName。我已经包含了Psapi.h,但是当我尝试编译时,我得到了 error LNK2019: unresolved external symbol _GetProcessImageFileNameA@12 referenced in function "bool __cdecl FindProcesses(char const *,class std::basic_string<char,struct std::char_traits

我正在尝试使用GetProcessImageFileName。我已经包含了Psapi.h,但是当我尝试编译时,我得到了

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
错误LNK2019:未解析的外部符号_GetProcessImageFileNameA@12在函数“bool\uu cdecl findprocess(char const*,class std::basic\u string*)”(?findprocess@@YA\u NPBDPAV?$basic)中引用_string@DU?$char_traits@D@性病病毒$allocator@D@2@@std@@@Z)99>G:\Test\main\Tests.exe:致命错误LNK1120:1未解析的外部
该函数出现在Itellisense中,所以有人能告诉我它为什么不编译吗?

这是一个链接器故障(它确实编译),与包含
Psapi.h
无关。您可能需要链接到
Psapi.lib

有关链接到哪个库的具体说明,请参见参考页的库部分:

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 Windows 7和Windows Server 2008 R2上的Kernel32.lib; Windows 7和Windows Server 2008 R2上的Psapi.lib(如果Psapi_VERSION=1); Windows Server 2008、Windows Vista、Windows Server 2003、, 和Windows XP