一个简单的程序报错
编译器报错:1.错误(活动) E0144 "const wchar_t *" 类型的值不能用于初始化 "TCHAR *" 类型的实体
2.警告 C28251 “WinMain”的批注不一致: 此实例包含 无批注
3.错误 C2440 “初始化”: 无法从“const wchar_t ”转换为“TCHAR *”
代码:
#include <Windows.h>
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
{
TCHAR* szContent = TEXT("lolololololol!");
static TCHAR szCaption[] = TEXT("title");
MessageBox(NULL, szContent, szCaption, MB_YESNO | MB_ICONEXCLAMATION | MB_DEFBUTTON2);
return 0;
} 本帖最后由 jackz007 于 2023-1-15 14:44 编辑
#include <windows.h>
#pragma comment(lib , "User32.lib")
int WINAPI WinMain(HINSTANCE hInstance , HINSTANCE hPrevInstance , LPSTR lpCmdLine , int nShowCmd)
{
MessageBox(NULL, "lolololololol!" , "title" , MB_YESNO | MB_ICONEXCLAMATION | MB_DEFBUTTON2) ;
return 0 ;
}
编译:
:
cl x.c
:
g++ -static -mwindows -o x x.c
页:
[1]