I am trying to retrieve the name of remote processes using "GetProcessImageFileName". However, the GCC (MinGW) linker fails with the following error(s):
<source_file>.c: In function '<function_name>':
warning: implicit declaration of function 'GetProcessImageFileName' [-Wimplicit-function-declaration]
GetProcessImageFileName(hProcess, szProcessName, MAX_PATH);
^
undefined reference to `GetProcessImageFileName'
collect2.exe: error: ld returned 1 exit status
I've tried compiling with "-lPsapi" and "-lKernel32" but I get the same results. "GetProcessImageFileName" is declared in "Psapi.h".
I'm using a machine with Windows 7 Professional 64-bit and GCC 4.8.1. Any ideas what's going on?