【发布时间】:2022-01-25 13:43:47
【问题描述】:
我正在尝试使用 C++ 创建一个窗口,但它给了我这个错误。
m_hWnd = CreateWindowEx(
0,
CLASS_NAME,
L"Window",
style,
rect.top,
rect.right - rect.left,
rect.bottom - rect.top,
NULL,
NULL,
hInstance, // first error line is here
NULL
); // second error line is here
第一个错误行告诉我identifier "hInstance" is undefined,而我之前多次使用它并没有给我一个错误,第二个错误告诉我too few arguments in function call。
【问题讨论】:
-
给定当前代码,错误是正确的。您没有在显示的代码中声明名为
hInstance的变量。 -
您使用
hInstance“之前”的地方可能与您在此处尝试使用它的范围不同。
标签: c++ winapi compiler-errors scope arguments