Okay, this just makes me feel stupid. I'm pretty good at programming for the console so I figured I would try a Win32 program. Apparently I'm stupid because I cannot even compile hello world. Heres the code I copy and pasted.

#include <windows.h>
int APIENTRY WinMain(HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPSTR     lpCmdLine,
                     int       nCmdShow)
{
 	
	MessageBox(NULL, "\tHello World!", "My first windows app", NULL);
	return 0;
}

I'm getting this error twice:

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


Can anyone help me get this working? I already tried google.

Recommended Answers

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

See this codeproject article What are TCHAR, WCHAR, LPSTR, LPWSTR, LPCTSTR etc?

Jump to Post

I believe you need to change, in your project settings, that you're using a multi-byte character set instead of Unicode. That should solve your problem.

Jump to Post

All 5 Replies

char* is not a wide string, which is needed. There is a lot of help via google.

I believe you need to change, in your project settings, that you're using a multi-byte character set instead of Unicode. That should solve your problem.

MessageBox(NULL, "\tHello World!", "My first windows app", NULL);

Change to

MessageBox(NULL, L"\tHello World!", L"My first windows app", NULL);

I believe you need to change, in your project settings, that you're using a multi-byte character set instead of Unicode. That should solve your problem.

Thank you this worked. Now I'm off to learn.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.