Sergio Calderon
Sergio Calderon

Reputation: 867

fatal error LNK1120: 1 unresolved externals for WDStatus function

I am trying to use the WDStatus function from the Windows Defender API with this code:

// WDStatus function
HRESULT result;
BOOL defStatus;

result = WDStatus(&defStatus);

if (result==S_OK)
{
    if (defStatus)
        puts("Defender Antivirus is enabled.");
    else
        puts("Defender Antivirus is not enabled.");

}
else
{
    puts("Failed to get the result.");
}

However, I am receiving this error from Visual Studio while compiling:

fatal error LNK1120: 1 unresolved externals

I assume this has something to do with MpClient.dll, but I don't know how to add it. Can you help me?

Upvotes: 0

Views: 42

Answers (1)

Jeaninez - MSFT
Jeaninez - MSFT

Reputation: 4040

In general, error LNK1120 is accompanied by LNK2001 or LNK2019 errors.

You don't need to fix this error. This error goes away when you correct all of the LNK2001 and LNK2019 linker errors before it in the build output.

I assume this has something to do with MpClient.dll, but I don't know how to add it.

I suggest you could try to add the following code:

#pragma comment(lib, "MpClient.lib")

Upvotes: 0

Related Questions