HAFF'S game engine help

Started by
4 comments, last by orphankill 14 years, 11 months ago
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
Advertisement
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.
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.
Holy crap, you can read!
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.

throw table_exception("(? ???)? ? ???");

changing the character set or using capital L still doesn't work i get this message now fatal error LNK1120: 1 unresolved externals
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")

This topic is closed to new replies.

Advertisement