这是我第一次使用 Win32 API。我想做的是制作一个简单的窗口。我正在 Windows 10 上的 Visual Studio 2019 中编写代码,并安装了使用 C++ 所需的所有东西。我遇到的问题是,我在网络上搜索找到的代码都不起作用,即使只是简单的wWinMain. 我做的事情是完全错误的吗?或者 VS2019 或 Windows 10 有什么特别之处吗?
我尝试从许多不同的来源运行代码。cl还尝试从终端使用编译器手动运行代码。
代码:
#include <windows.h>
int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nShowCmd) {
/* Some Code*/
return 0;
}
Run Code Online (Sandbox Code Playgroud)
错误:
Warning C28251 Inconsistent annotation for 'wWinMain': this instance has no annotations.
Error LNK2019 unresolved external symbol _main referenced in function "int __cdecl invoke_main(void)" (?invoke_main@@YAHXZ)
Error LNK1120 1 unresolved externals
Run Code Online (Sandbox Code Playgroud)