Error (active) E0167 argument of type "const char *" is incompatible with parameter of type "LPCWSTR" Test04 C:\Demo_GLUT\Test04\Test04.cpp 464
- argument of type const char* is incompatible with parameter of type “LPCWSTR”
- ConstChar Error, Coding/Gaming
I am trying to make a simple Message Box in C in Visual Studio 2012, but I am getting the following error messages
error LNK2019:unresolved external symbol_main referenced in function_tmainCRTStartup
A Solution: Check your project's Character Set setting (Project Properties, Configuration Properties, General, Character Set). It's probably set to "Use Unicode" instead of "Use Multi-Byte".
To make your code compile in both modes, enclose the strings in _T() and use the TCHAR equivalents#include < windows.h >
int WINAPI _tWinMain(HINSTANCE hinstance, HINSTANCE hPrevinstance, LPTSTR lpszCmdLine, int nCmdShow)
{
MessageBox(0,_T("Hello"),_T("Title"),0);
return 0;
}
A Solution: I recently ran in to this issue and did some research and thought I would document some of what I found here.
To start, when calling MessageBox(...), you are really just calling a macro (for backwards compatibility reasons) that is calling either MessageBoxA(...) for ANSI encoding or MessageBoxW(...) for Unicode encoding.
ERROR 1 NAME : argument of type "WCHAR" is incompatible with parameter of type "const char*"
ERROR 2 NAME : argument of type "const char*" is incompatible with parameter of type "LPCWSTR"
This is a paragraph.
This is a paragraph.
This is a paragraph.
This is a paragraph.
This is a paragraph.
This is a paragraph.
This is a paragraph.
This is a paragraph.
This is a paragraph.
This is a paragraph.
This is a paragraph.
This is a paragraph.
This is a paragraph.
This is a paragraph.
This is a paragraph.
This is a paragraph.
No comments:
Post a Comment