编译错误C2664或C2731 c++ 2015
Compiler Error C2664 or C2731 C++ 2015
我已经能够细化WinMain
函数。现在我想做一个win32
应用程序:
#include <Windows.h>
int WINAPI WinMain() {
MessageBox(NULL,"Test", "Hello World", NULL);
return 0;
}
然后我得到错误C2731
您没有为WinMain()方法提供任何参数,并且错误C2731说该方法不能重载。
从MSDN:int WINAPI WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow);
错误C2664最有可能是你对MessageBox的调用,所以尝试更改为:
MessageBox(NULL, L"Test", L"Hello World", NULL);
我发现我没有使用main.cpp作为我的主要源代码文件,我的WinMain需要切换到wWinMain
相关文章:
- Visual Studio 2015:Extern "C" 和 "export" 关键字
- vs 2015 constexpr变量不恒定,但与2019相比还好吗
- 从VS 2015更新3更新到VS2015更新3 d后浮点计算行为不同的原因
- VS 2015 链接错误 无法构建依赖于 libcurl 的项目
- Qt Visual Studio 2015 加载项编译问题
- 包含在 <WinSock2> Visual Studio 2015 中时出现错误
- 在 Windows 10 上的 Visual Studio 2015 中使用 _open 和 _setmode
- 如何在不进入 Visual Studio 2015 中的外部库的情况下单步执行我的代码 (F11)
- 为什么使用 <uint8_t>MSVC 2015 编译器的 std::vector::insert 比 std::copy 快 5 倍?
- c++ Visual Studio 2015 快捷方式,用于从选择代码中生成功能
- Visual Studio 2015资源视图和资源编译器使用不同的方法在项目目录中查找图标文件.如何修复
- Visual Studio 2015 中的调试速度很慢 -- 无法关闭页面堆?
- VisualStudio 2015 - 只计算命中,不停止
- 在 C++ 中使用带有正则表达式的 G++ 和 Visual Studio 14 2015 编译器时会产生不同的结果
- 安装 SFML 后 Visual Studio 2015 中出现错误
- WinDBG适用于从Visual Studio 2015保存的转储,但不适用于任务管理器。显示异常代码"not found"
- 如何使用VS 2015构建Boost 1.44
- 图标编辑器中的自定义颜色 (VS 2015)
- 在Visual Studio 2017上使用VC++ 2015工具链时缺少ATL标头
- VS 2015 linking fltlib.lib