Unresolved symbol errors within DLL-Collection of common programming errors

For background, I have come across this porting a medium-sized linux codebase (compiling into a giant .so) to x64 windows (compiling into a .dll). I have had linker trouble.

As a minimal testcase, if I create a Visual Studio project from just the following file:

#include 
#include 

void do_stuff(char const * s)
{
  char buffer[4096];
  long int len = UnDecorateSymbolName(
    s,
    buffer,
    sizeof(buffer),
    UNDNAME_COMPLETE);
}

And I set the project type to DLL and build it, I get an error “LNK2001: Unresolved external symbol __imp_UnDecorateSymbolName”. That is, the file compiles properly, but fails to link into a dll.

I think the goal is for my dll to link to dbghelp.dll, especially since (at least on my system) there is no such file as a dbghelp.lib. So why is it trying to resolve that symbol now, rather then when my DLL is loaded into an application? And why can’t it see that function anyhow?

To be clear, I have confirmed that I am building the x64 DLL, and that the dbghelp.dll in C:\Windows\System32 is x64.