Communication error 2001 when linking to User32.dll

I am trying to link an object file that uses two methods declared in winuser.h and defined in User32.dll: GetMonitorInfo and WindowFromMonitor. The source compiles to the object file just fine, but when I try to link, I get the following error output:

D3dCtx.obj : error LNK2001: unresolved external symbol xGetMonitorInfo
D3dCtx.obj : error LNK2001: unresolved external symbol xMonitorFromWindow

The fact is that I do not call "xGetMonitorInfo" or "xMonitorFromWindow". Running grep on all source files shows that only "GetMonitorInfo" and "WindowFromMonitor" are called. I correctly enable windows.h, which includes winuser.h. I also set LIBPATH correctly in the linker settings, as evidenced by the detailed output of the links.

My verbose link output also shows the following:

Found __imp_GetMonitorInfoA
    Referenced in nafxcw.lib(afxribboncategory.obj)
    Referenced in nafxcw.lib(afxtooltipctrl.obj)
    Referenced in nafxcw.lib(afxribbonkeytip.obj)
    Referenced in nafxcw.lib(afxfullscreenimpl.obj)
    Referenced in nafxcw.lib(afxframeimpl.obj)
    Referenced in nafxcw.lib(afxglobalutils.obj)
    Referenced in nafxcw.lib(afxdropdowntoolbar.obj)
    Referenced in nafxcw.lib(wincore.obj)
    Referenced in nafxcw.lib(afxglobals.obj)
    Referenced in nafxcw.lib(afxpopupmenu.obj)
    Referenced in nafxcw.lib(afxpropertygridtooltipctrl.obj)
    Loaded User32.lib(USER32.dll)
Found __imp_MonitorFromWindow
    Referenced in nafxcw.lib(wincore.obj)
    Loaded User32.lib(USER32.dll)

, GetMonitorInfo winuser.h :

WINUSERAPI
BOOL
WINAPI
GetMonitorInfoA(
    __in HMONITOR hMonitor,
    __inout LPMONITORINFO lpmi);
WINUSERAPI
BOOL
WINAPI
GetMonitorInfoW(
    __in HMONITOR hMonitor,
    __inout LPMONITORINFO lpmi);
#ifdef UNICODE
#define GetMonitorInfo  GetMonitorInfoW
#else
#define GetMonitorInfo  GetMonitorInfoA
#endif // !UNICODE

"GetMonitorInfo" "GetMonitorInfoA",

D3dCtx.obj: LNK2001: xMonitorFromWindow

. , MonitorFromWindow, , .

, 64- , cl.

, ?

+5
1

, . , , multimon.h

, 64- - , , multimon.h .

, , .

//#include <multimon.h>
+2

All Articles