Windows7.1 SDK:C2373:"MonitorFromWindow"重新定义 [英] Windows7.1 SDK: C2373: "MonitorFromWindow" Redefinition
问题描述
对于以下说明,给出了32位版本VS10 MCBS中的错误链接规范与先前的"MonitorFromWindow"不兼容":
The error "linkage specification is incompatible with previous "MonitorFromWindow"" in 32 bit build VS10 MCBS is given for the following decl:
int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR pCmdLine, int nCmdShow)
{
HMONITOR MonitorFromWindow(_In_ HWND hwnd, _In_ DWORD dwFlags);
return DialogBoxW(hInstance, MAKEINTRESOURCEW(lpTemplate), nullptr, DlgProc);
}
Assumed the solution would be similar to the one given here, but here it might be some problem with the SDK although some kind of header hack is preferred.
推荐答案
该错误告诉您MonitorFromWindow
的声明与先前的声明冲突. Winuser.h
中的先前声明使用extern "C"
链接声明了该函数,该函数为__declspec(dllimport)
,并具有__stdcall
调用约定.
The error is telling you that your declaration of MonitorFromWindow
conflicts with the prior declaration. The prior declaration in Winuser.h
declared the function with extern "C"
linkage, is __declspec(dllimport)
and has the __stdcall
calling convention.
您应该删除错误的声明,并从头文件中使用它.
You should remove your erroneous declaration and use that from the header file.
这篇关于Windows7.1 SDK:C2373:"MonitorFromWindow"重新定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!