VS 2019 C++桌面程序,提示C28251:“WinMain"批注不一致,此实例包含 无批注:
int WINAPI WinMain(
HINSTANCE hInstance, // handle to current instance
HINSTANCE hPrevInstance, // handle to previous instance
LPSTR lpCmdLine, // command line
int nCmdShow // show state
)
解决方法1:(无效)
项目->链接器->系统->子系统中要选用窗口而不是控制台。
解决方法2:
需要_In_ 检测,修改如下
int WINAPI WinMain(
_In_ HINSTANCE hInstance, // handle to current instance
_In_opt_ HINSTANCE hPrevInstance, // handle to previous instance
_In_ LPSTR lpCmdLine, // command line
_In_ int nCmdShow // show state
)