TGB & Visual Studio 2008 Pro compiling issues with unicode
by Daniel Dewey · in Torque Game Builder · 12/31/2008 (1:07 pm) · 1 replies
Greetings all,
I've been running into a constant issue with trying to compile TGB in Visual Studios 2008 under Windows Vista Home Premium. I've gotten TGE to compile correctly, but TGB is just confusing me to no end. The first error I get passing all the warnings of sprintf is:
8>..\..\source\platformWin32\nativeDialogs\win32MsgBox.cpp(76) : error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const UTF16 *' to 'LPCWSTR'
I'm using the .net solution and not the VisualStudio 2005 solution. I've tried doing a search for help on this and didn't find anything, but if there is already a post on this that I missed, please forgive me.
Thanks to all who help.
Daniel
I've been running into a constant issue with trying to compile TGB in Visual Studios 2008 under Windows Vista Home Premium. I've gotten TGE to compile correctly, but TGB is just confusing me to no end. The first error I get passing all the warnings of sprintf is:
8>..\..\source\platformWin32\nativeDialogs\win32MsgBox.cpp(76) : error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const UTF16 *' to 'LPCWSTR'
I'm using the .net solution and not the VisualStudio 2005 solution. I've tried doing a search for help on this and didn't find anything, but if there is already a post on this that I missed, please forgive me.
Thanks to all who help.
Daniel
Associate amaranthia
You'll need to reset this setting to remove your reported, and many further errors.
To do so, simply select each project in the "Solution Explorer", right click, and select the "Properties..." menu option.
Next, expand the "Configuration Properties" tree item, then expand the "C/C++" item, and select the "Language" entry.
On the right, you'll see the "Treat wchar_t as Built-in Type"... change this to "No (/Zc:wchar_t-)".
Now, before you get too excited and start your rebuild, let's fix a few more things, and make sure you spend your compile-time wisely.
Firstly, have you already edited your "torqueConfig.h" file? If you're not going to leverage UNICODE, you're going to want to comment out (or #ifdef) the "TORQUE_UNICODE" entry.
Next, make sure to take the "UNICODE" entry out of your project "Preprocessor Definitions" list... yes, you'll need to take it out of all of the projects in your solution, and in each configuration as they are dependent upon each other.
Since you're already in the project settings dialog, you may want to take this opportunity to add the additional include and lib directories of the platform SDK as the foremost entries in their respective "Additional..." places. TGBGame will also need the include path placed in its "Additional..." resource path.
With all this joy behind us, we've not only a couple source changes:
Win32DirectoryResolver.h
Line #15 needs to be changed from:
IShellLink* mPSL;
to
IShellLinkW* mPSL;
Win32DirectoryResolver.cpp
Line #88 needs to be changed from:
WIN32_FIND_DATA wfd;
to
WIN32_FIND_DATAW wfd;
Line #92 needs to be changed from:
(WIN32_FIND_DATA *)&wfd,
to
(WIN32_FIND_DATAW *)&wfd,
Line #97 needs to be changed from:
result = PathIsDirectory( wpath );
to
result = PathIsDirectoryW( wpath );
WinFont.CC
Line #188 needs to be changed from:
BOOL CALLBACK EnumFamCallBack(LPLOGFONTW logFont, LPNEWTEXTMETRICW textMetric, DWORD fontType, LPARAM lParam)
to
BOOL CALLBACK EnumFamCallBackW(LPLOGFONTW logFont, LPNEWTEXTMETRICW textMetric, DWORD fontType, LPARAM lParam)
Line #205 needs to be changed from:
EnumFontFamiliesW( fontHDC, fontFamily, (FONTENUMPROC)EnumFamCallBack, (LPARAM)&fonts );
to
EnumFontFamiliesW( fontHDC, fontFamily, (FONTENUMPROCW)EnumFamCallBackW, (LPARAM)&fonts );
There are plenty of other settings worthy of consideration beyond these... but this should solve your building issue.