0

I Have an MFC Dialog application. I use win7 service pack 1 32 bit, Visual Studio 2010, MFC 2008/2010. This is a part of my dlg file

//getprocessDlg.cpp
        #include <psapi.h>
        // TODO: Add extra initialization here
    DWORD aProcesses[1024], cbNeeded, cProcesses;
    unsigned int i;

    if ( !EnumProcesses( aProcesses, sizeof(aProcesses), &cbNeeded ) )
    {
        return 1;
    }

When i Run, it display error. That's it

Error 1 error LNK2019: unresolved external symbol _EnumProcesses@12 referenced in function "protected: virtual int __thiscall CgetprocessDlg::OnInitDialog(void)" (?OnInitDialog@CgetprocessDlg@@MAEHXZ) c:\Users\AnhNT\documents\visual studio 2010\Projects\getprocess\getprocess\getprocessDlg.obj getprocess

Error 2 error LNK2019: unresolved external symbol _GetModuleBaseNameW@16 referenced in function "public: void __thiscall CgetprocessDlg::PrintMemoryInfo(unsigned long)" (?PrintMemoryInfo@CgetprocessDlg@@QAEXK@Z) c:\Users\AnhNT\documents\visual studio 2010\Projects\getprocess\getprocess\getprocessDlg.obj getprocess

I try all day but it has not work. Can somebody help me :(

lex_luther_9x
  • 111
  • 1
  • 2
  • 10

1 Answers1

2

Add Psapi.lib to the list of linker dependencies.

Project - Properties - Configuration Properties - Linker - Input - Additional Dependencies. Type Psapi.lib there.

Alex F
  • 42,307
  • 41
  • 144
  • 212