Win API App Troubles w/ compiling:

I am using the (in)famous Win API tutorial by "the Forger" (on Winprog.org) and am using the hello world first app in it. Here it is:
1
2
3
4
5
6
7
#include <windows.h>
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow)
{
MessageBox(NULL, "Goodbye, cruel world!", "Note", MB_OK);
return 0;
}

And I got a Build Error:
1>------ Build started: Project: API Test1, Configuration: Debug Win32 ------
1>  API Test1.cpp
1>c:\users\gio\desktop\documents\c++ programs\tests\api test1\api test1\api test1.cpp(5): error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const char [22]' to 'LPCWSTR'
1>          Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

I know the tutorial says not to ask before you're done reading, but this is obviously Compiler Trouble, which the writer has said he will not get into. Thanks!
Try putting L in front of your strings to make them wchars instead of normal chars.
Topic archived. No new replies allowed.