0

Windowsdefender.h LNK2001 Error on Compile Using Visual Studio 2022 Community Edition

I work on doing small projects with C++, trying to build things using just C++ without C#, .Net and other tools. While doing this, I ran into a problem with building around windowsdefender.h. What I tried to do was more or less this:

#include <Windows.h>
#include <tchar.h>
#include <WindowsDefender.h>

int main()
{
    BOOL result;
    HRESULT output;
    output = WDStatus(&result);

    return 0;
}

The program only extract the status information, but it does not compile. I get a link error.

error LNK2001: unresolved external symbol _WDStatus@4

Looking around university as well as google lead me to belive that I need to manualy add a lib file or direction for the linker. One that contain the code it needs for windowsdefender.h to work. But... I am stumped. Been looking around and can not for the life of me find the information I need to do this. Is there a kind soul out there that know what I need to do to fix this?

I got dyslexia and my spell aid is failing me. So I am sorry for any issues in the above text!

  • 1
    The information is located in the [official documentation](https://learn.microsoft.com/en-us/windows/win32/api/windowsdefender/nf-windowsdefender-wdstatus) Note that Windows SDK does not supply corresponding .lib file for this .dll so you may need to either generate it yourself or load .dll manually (via `LoadLibrary`). – user7860670 May 31 '23 at 09:49

0 Answers0