Handmade Hero»Forums»Code
Brad B
7 posts
Unicode and MBCS in Visual Studio Express
Edited by Brad B on
I struggled with this all day. VS Express does not allow the user to get the add-on to be able to code this project in MBCS. The error first occurred on Day 2.

WindowClass.lpszClassName = ("HandmadeHeroWindowClass");

Error is looking for a value and instead the field is text. I almost gave up. The pay for version of VS is too expensive to consider buying just to do this project. I opted to include tchar.h and preceded the two occurrences of text with _t(). That was the only change and now it's working. I have the Window. I do not know how much a problem this will be as I go along so anyone that has encountered this and knows a better way I would like to hear from you. I see the game is about to be released but I want to do this myself so I'm a late starter. Didn't find this on you tube until a week ago.I just want to know if I'll be able to finish this with Express instead of the full VS 2015 at 45 dollars a month.
Stephen A
6 posts
None
Unicode and MBCS in Visual Studio Express
I'm using visual studio community which is currently free. Have you had a look at that?
Mārtiņš Možeiko
2559 posts / 2 projects
Unicode and MBCS in Visual Studio Express
Free versions of VS have exactly same compiler as Pro or Ultimate (or whatever else) editions of VS. So error you are getting will be the same.

I assume WindowClass is defined as WNDCLASS variable. In that case Your project most likely has set Character Set as "Unicode". This means that WNDCLASS is defined as WNDCLASSW thus it wants all members that are strings to have WCHAR* type.

If you want to use ANSI strings (char*) then you can:
1) change VS project setting to Multi-Byte Character Set: http://www.ogre3d.org/tikiwiki/ti...load_file.php?fileId=1665&display
2) change type of WindowClass variable to WNDCLASSA, then code will work regardless of project properties. This is what Casey is doing on stream, don't remember which day, but he changed WindowClass to be WNDCLASSA.

And as askinasa suggest - use Community edition instead of Express edition. It's free! Community edition is more complete and has more features. I'm not sure I remember correctly, but at one time Express edition didn't have ability to switch between threads when debugging. Community edition has pretty much same features as full paid VS edition, but it legally can be used only for individual developers or small teams. Casey is using Community edition on stream.
511 posts
Unicode and MBCS in Visual Studio Express
You can also use the TEXT() macro to create the string literals for the API calls that expect strings.
Mārtiņš Možeiko
2559 posts / 2 projects
Unicode and MBCS in Visual Studio Express
He is currently using _t macro, which is same thing as TEXT macro: https://msdn.microsoft.com/en-us/library/dybsewaf.aspx
The _T macro is identical to the _TEXT macro.
Brad B
7 posts
Unicode and MBCS in Visual Studio Express
Edited by Brad B on
Thanks for the reply. Struggled with express and then downloaded and installed Community. The option to change character sets in Express is not even shown. Easy to do with Community and it's working fine. Changed a few things ovto "A' setting also as Casey shows including WNDCLASS. So far so good :)
Mārtiņš Možeiko
2559 posts / 2 projects
Unicode and MBCS in Visual Studio Express
Oh, right. I think you need to enable some "advanced options" checkbox to see additional options. I don't really remember where it can be found.