Jump to content
  • Advertisement
Sign in to follow this  
Reznor91

HAFF'S game engine help

This topic is 3388 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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
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.

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
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
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
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!