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.

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.

This article has been dead for over six months. Start a new discussion instead.