【发布时间】:2016-03-01 15:25:58
【问题描述】:
我在 Visual Studio 2015 中创建了一个基本的 Windows C++ 应用程序,但出现了一些错误:
#include <windows.h>
#include <stdlib.h>
#include <string.h>
#include <tchar.h>
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
MessageBox(NULL, "Test_text", "Message Test", MB_ICONINFORMATION | MB_OKCANCEL);
return 0;
}
错误:
'int MessageBoxW(HWND,LPCWSTR,LPCWSTR,UNIT)': cannot convert argument 2 from 'const char [10]' to 'LPCWSTR' argument of type "const char *" is incompatible with parameter of type "LPCWSTR" argument of type "const char *" is incompatible with parameter of type "LPCWSTR"
【问题讨论】:
-
不要通过图像(内联或外部链接)显示错误或代码。始终在此处将错误的全文显示为文本。
-
如果您搜索消息文本,您已经找到了解决方案。
标签: c++ winapi visual-studio-2015 tchar lpcwstr