Skip to main content
GameDev.net gamedev.net
🔒 Locked

"cannot convert parameter" errors, when compiling torque 1.4

Started by kileran Feb 25, 2007 at 2:31 PM 7 replies 1.7k views
Original Post
kileran
kileran
I'm trying to compile the stock 1.4 build of torque, and i'm getting the following errors (same or similar error, 39 times in a row) Here's the first few of the 39 almost identical errors. ..\engine\platformWin32\winWindow.cc(33) : error C2440: 'initializing' : cannot convert from 'const wchar_t [22]' to 'const UTF16 *' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast ..\engine\platformWin32\winWindow.cc(34) : error C2440: 'initializing' : cannot convert from 'const wchar_t [16]' to 'UTF16 [256]' There is no context in which this conversion is possible ..\engine\platformWin32\winWindow.cc(109) : error C2664: 'CreateMutexW' : cannot convert parameter 3 from 'UTF16 [512]' to 'LPCWSTR' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast ..\engine\platformWin32\winWindow.cc(134) : error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'UTF16 [1024]' to 'LPCWSTR' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast ..\engine\platformWin32\winWindow.cc(148) : error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'UTF16 [1024]' to 'LPCWSTR' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast ..\engine\platformWin32\winWindow.cc(162) : error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'UTF16 [1024]' to 'LPCWSTR' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast ..\engine\platformWin32\winWindow.cc(372) : error C2664: 'ToUnicode' : cannot convert parameter 4 from 'U16 [3]' to 'LPWSTR' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast ..\engine\platformWin32\winWindow.cc(877) : error C2440: '=' : cannot convert from 'const UTF16 *' to 'LPCWSTR' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast Although i'm an absolute newb to VC++ (my history with C ended in 1997 with borland C++ 4.0), i think this is because the torque source is written for VC7, and VC2005 is VC8. I could be TOTALLY out of whack here though. Is there a simple way to rewrite these lines?
kileran
kileran
Sorry, here's the rest of the info you'l need to know what the hell i'm talking about.

Error 1
..\engine\platformWin32\winWindow.cc(33) : error C2440: 'initializing' : cannot convert from 'const wchar_t [22]' to 'const UTF16 *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast

Line 33
static const UTF16 *windowClassName = L"Darkstar Window Class";


Error 2
..\engine\platformWin32\winWindow.cc(34) : error C2440: 'initializing' : cannot convert from 'const wchar_t [16]' to 'UTF16 [256]'
There is no context in which this conversion is possible

Line 34
static UTF16 windowName[256] = L"Darkstar Window";
skyfire360
skyfire360
I know that has to do with VS2005's basing strings on unicode, but unfortunately I don't know much more in the way of details than that. Try searching on GarageGames' website/forums for "unicode" and you might find out more.
I do real things with imaginary numbers
kileran
kileran
amazingly, it seems that only 1 person has had that problem before, i found his post, and nobody answered it.

Thanks for the idea though, "unicode" brought up more results than just searching "winwindow.cc"
JohnBolton
JohnBolton
Just a guess: try setting the character set in the projects properties to Multi-Byte Character Set.
John BoltonLocomotive Games (THQ)Current Project: Destroy All Humans (Wii). IN STORES NOW!
kileran
kileran
Specifying either "multi-byte" or "Unicode" didn't work :(

someone recomended i get the SDK, but I dont know which one they mean.
kileran
kileran
i found the SDK, that didn't help either.

wow, i would have never expected this problem to be so... problematic.
Excors
Excors
You might want to try changing the C/C++ -> Language -> Treat wchar_t as Built-in Type setting. That should make wchar_t be equivalent to unsigned short, which is presumably what UTF16 is, and then hopefully the compiler would be happy to convert between them automatically. (VC2005 changed the default for that setting.)
kileran
kileran
I found a patch, fixed all the problems.

Thanks for all your help guys!

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.