Sign in to follow this  
Reznor91

HAFF'S game engine help

Recommended Posts

Reznor91    100
hey i have recently downloaded HGE because I'm not ready to begin Direct 3D 10 programming but when i go to compile the first tutorial included with the download i get this error message i dunno why i get this as i have included all necessary files error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'char *' to 'LPCWSTR' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast can anyone help please

Share this post


Link to post
Share on other sites
Drew_Benton    1861
When you create a new project in Visual Studio, it has a default Character Set of Unicode. You will need to change it to the Multi-Byte Character Set.

Simply go to your project properties, expand Configuration Properties and click on General. Make the changes in the Character Set field for both Debug and Release configurations.

Share this post


Link to post
Share on other sites
I'm not sure if this is right or not, but where that "" are in the message box parameters, place a capital L in front. Example:

MessageBoxW ( 0, L"Title or whatever", L"Information regarding this pop-up", MB_OK );

I think it's something like that. Keyword: think.

Share this post


Link to post
Share on other sites
Ravyne    14300
This kind of message, referring to char pointers and LPCWSTRs usually means that you're attempting to use ASCII(8bit) strings, rather than the appropriate Unicode (16 or 32 bit) strings.

Open up your project properties -> Configuration Properties -> General and you will see an entry for "Character Set", make sure this is set how the library expects it to be set, which ought to be documented somewhere in the libraries documentation... failing that, it seems to be the opposite of what you have going on now.

You'll also want to wrap all your strings in the Text macro, such that "This is a string." becomes TEXT("This is a string.") or, if I recall correctly, you can also prepend a capital 'L' before the string: L"This is a string.". Wrapping it in the TEXT macro is better because it converts to the currently configured type, whereas prepending 'L' always sets it to multi-byte. Also, I've seen _T used as a short-hand for TEXT, but I prefer the latter since its more explicit and only two more keystrokes.


There's a little more info on this stuff here.

Share this post


Link to post
Share on other sites
Reznor91    100
changing the character set or using capital L still doesn't work i get this message now fatal error LNK1120: 1 unresolved externals

Share this post


Link to post
Share on other sites
orphankill    122
Changing the configuration in a 'ALL Configurations' to either 'Not Set' or 'Multi-Byte' will work. The unresolved external is unrelated most likely. You probably forgot to link the HGE libraries, so add this to your main header:

#pragma comment (lib, "hge.lib")
#pragma comment (lib, "hgehelp.lib")

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