const char *类型的参数是类型和QUOT的参数不符; LPCWSTR" [英] argument of type const char* is incompatible with parameter of type "LPCWSTR"

查看:331
本文介绍了const char *类型的参数是类型和QUOT的参数不符; LPCWSTR"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图让在Visual Studio 2012在C简单的消息框,但我正在逐渐
以下错误消息

I am trying to make a simple Message Box in C in Visual Studio 2012, but I am getting the following error messages

argument of type const char* is incompatible with parameter of type "LPCWSTR"

err LNK2019:unresolved external symbol_main referenced in function_tmainCRTStartup

下面是源$ C ​​$ C

Here is the source code

#include<Windows.h>

int _stdcall WinMain(HINSTANCE hinstance,HINSTANCE hPrevinstance,LPSTR lpszCmdline,int nCmdShow)
{

    MessageBox(0,"Hello","Title",0);

    return(0);
}

请帮助

感谢和问候

推荐答案

为使您的code在这两种模式下进行编译,请用_T(琴弦),并使用TCHAR等价物

To make your code compile in both modes, enclose the strings in _T() and use the TCHAR equivalents

#include <tchar.h>
#include <windows.h>

int WINAPI _tWinMain(HINSTANCE hinstance, HINSTANCE hPrevinstance, LPTSTR lpszCmdLine, int nCmdShow)
{
    MessageBox(0,_T("Hello"),_T("Title"),0);
    return 0;
}

这篇关于const char *类型的参数是类型和QUOT的参数不符; LPCWSTR&QUOT;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆