Hi there;
I entered a simple C++ program from a book on video games, and I'm getting a compile error. You can see the compiler error message down below, along with the text of the program.
Does anyone know what the problem is? I should note that the author used MS Visual C++ 2003, whereas I'm using the 2005 Express edition, so I'm guessing there might be something different between the two versions. Also, I compiled this in Dev C++ and it worked fine. However, I'm trying to improve my Express skills, so I'd love to learn how to fix this.
Thanks,
FremontKnight
************************************************** ****
This is the code of the program:
Code://#define WIN32_LEAN_AND_MEAN #include <windows.h> //#include <windowsx.h> int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd) { MessageBox(NULL, "Motoko Kusanagi has hacked your system!", "Public Security Section 9", MB_OK | MB_ICONEXCLAMATION); return 0; }
Here is the compiler feedback:
************************************************** **
------ Build started: Project: Chapter 2, Configuration: Debug Win32 ------
>Compiling...
>Chapter 2 Program.cpp
>c:\documents and settings\paul\my documents\visual studio 2005\projects\chapter 2\chapter 2\chapter 2 program.cpp(14) : error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const char [40]' to 'LPCWSTR'
> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
>Build log was saved at "file://c:\Documents and Settings\Paul\My Documents\Visual Studio 2005\Projects\Chapter 2\Chapter 2\Debug\BuildLog.htm"
>Chapter 2 - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========