I am receiving the following errors in my win32 api code in devc++:
[Linker error] undefined reference to `EnumProcessModules@16'
[Linker error] undefined reference to `GetModuleFileNameExA@16'
ld returned 1 exit status
How can I solve this problem? I tried using
#pragma comment(lib, "psapi.lib")
since it was a linker issue but it did not help whatsoever.
Link with the library that provides the missing functions.
As mentioned in the question comments, g++ (which most likely is the compiler that you’re using with DevC++) does unfortunately not support
#pragma comment.Also, as mentioned in the question comments, DevC++ is a rather outdated and ungood IDE. Since you are using Windows, try out e.g. Code::Blocks IDE for the g++ compiler, or Microsoft’s Visual C++ Express IDE for Visual C++. And with the latter you can use the
#pragma, if you want…