compile errors

i've tried everything i can think of and can't figure out whats going on here. i try to compile my win32 window, and these are the errors i get. this code is copied directly from another window i made which compiles fine.

c:\documents and settings\family\my documents\visual studio 2005\projects\window2\window2\winmain.cpp(26) : error C2440: '=' : cannot convert from 'const char *' to 'LPCWSTR'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
c:\documents and settings\family\my documents\visual studio 2005\projects\window2\window2\winmain.cpp(44) : error C2664: 'CreateWindowExW' : cannot convert parameter 2 from 'const char *' to 'LPCWSTR'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
c:\documents and settings\family\my documents\visual studio 2005\projects\window2\window2\winmain.cpp(62) : warning C4244: 'return' : conversion from 'WPARAM' to 'int', possible loss of data


Answer this question

compile errors

  • Nicholas Wagner

    You have a const char * and want to convert it to a const wchar_t *.

    Applications can use unicode or MBCS, the great difference is that a unicode char is a 16bit value, were a MBCS character is usually 8bits long.

    The SDK uses either a Unicode interface (functions with W extension) or an MBCS interface with A extension, depending on the settings of the UNICODE define. It seams that you have UNICODE defined but you are using standard strings. Either use the _T macro or the L"wide char string" mode.



  • RobSmith

    thanks, i changed the project settings to mbcs and it fixed the error. might not be the best way but it worked. thanks for the info :)

  • compile errors