Sign in to follow this  
SB4

compile error with simple Win32 Application

Recommended Posts

hello, I'm reading Beginning Game Programming (Jonathan S. Harbour), when i want to compile simple HelloWorld Application :
#include<windows.h>

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
				   LPSTR lpCmdLine, int nCmdShow)
{
	MessageBox(NULL, "All your base are belong to us!",
		"Hello World", MB_OK | MB_ICONEXCLAMATION);
}
Visual C++ ( Visual Studio 2005 ) show me this output :
1>------ Build started: Project: 001_HelloWorld, Configuration: Debug Win32 ------
1>Compiling...
1>main.cpp
1>c:\documents and settings\toshiba\my documents\visual studio 2005\projects\001_helloworld\001_helloworld\main.cpp(10) : error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const char [32]' to 'LPCWSTR'
1>        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>Build log was saved at "file://c:\Documents and Settings\TOSHIBA\My Documents\Visual Studio 2005\Projects\001_HelloWorld\001_HelloWorld\Debug\BuildLog.htm"
1>001_HelloWorld - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

and stop compile what's the problem and how to solve it ? if the is any good books for create Win32 Application please post the name of the book thanks in advance... Regards, SB4

Share this post


Link to post
Share on other sites
Go to your project settings, under general, and change character set from "Use Unicode Character Set" to "Use Multi-Byte Character Set"

Share this post


Link to post
Share on other sites
SiCrane, MJP & boolean010 thank u very much

MJP link don't work show this massage :
Microsoft VBScript runtime error '800a000d'

Type mismatch: 'CLng'

/community/forums/mod/journal/journal.asp, line 224


Regards,
SB4

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this