WCHAR Compile advice requested.
by Andrew "Blorf" Hume · in Technical Issues · 04/08/2011 (5:58 pm) · 2 replies
Hi All,
I am within a week of releasing my project for Beta and have run into a snag involving WCHAR. When TGB is compiled, under ConfigurationProperties/C/C++/Language/Treat wchar_T as a Built in Type, we ALL have it set to No (/Zc:wchar_t-)
However, the security SDK I am using extensively uses WCHAR, more exactly, LPCWSTR and LPWSTR which will not compile under the above settings.
I have spent the day trying to work around this with the help of a coder buddy of mine, but have not had any luck. We tried to convert typeDef wchar_t WCHAR to typedef unsigned short WCHAR, but to no avail.
I was hoping someone has run into this in the past and has resolved the issue. Otherwise, any ideas or suggestions would be great. The compile errors look like the following:
1>..\..\source\game\****.cpp(244) : error C2664: 'strlen' : cannot convert parameter 1 from 'const wchar_t *' to 'const char *'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
If I allow wchar_t as a built in type, then the SDK will compile without issue, but there are errors sprinkled throughout the rest of the TGB code base.
One potential option is to compile TGB with unicode undefined. I do not know how common it is to do this though. If anyone has thoughts on how dangerous that could be I am also all ears.
Thanks for any help,
Andrew
I am within a week of releasing my project for Beta and have run into a snag involving WCHAR. When TGB is compiled, under ConfigurationProperties/C/C++/Language/Treat wchar_T as a Built in Type, we ALL have it set to No (/Zc:wchar_t-)
However, the security SDK I am using extensively uses WCHAR, more exactly, LPCWSTR and LPWSTR which will not compile under the above settings.
I have spent the day trying to work around this with the help of a coder buddy of mine, but have not had any luck. We tried to convert typeDef wchar_t WCHAR to typedef unsigned short WCHAR, but to no avail.
I was hoping someone has run into this in the past and has resolved the issue. Otherwise, any ideas or suggestions would be great. The compile errors look like the following:
1>..\..\source\game\****.cpp(244) : error C2664: 'strlen' : cannot convert parameter 1 from 'const wchar_t *' to 'const char *'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
If I allow wchar_t as a built in type, then the SDK will compile without issue, but there are errors sprinkled throughout the rest of the TGB code base.
One potential option is to compile TGB with unicode undefined. I do not know how common it is to do this though. If anyone has thoughts on how dangerous that could be I am also all ears.
Thanks for any help,
Andrew
#2
12/11/2012 (8:53 am)
Sorry, no luck in resolving that as I remember. In the end we just used a different DRM system that did not require the above to work.
Torque 3D Owner Ryan Santos
Weike Gaming Technology