Jump to content
  • Advertisement
Sign in to follow this  
Lord_Vader

VC2005?

This topic is 4236 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello all, Can somenone tell me why when I am changing from debug mode to release mode a bunch of error messages like: error C2440: '=' : cannot convert from 'char *' to 'LPCWSTR' error C2664: 'SetWindowTextW' : cannot convert parameter 2 from 'char [128]' to 'LPCWSTR' . . . appears? And after some type_casting the programm compiles at release mode but it doesnt compile at debug mode Moreover what is the difference between the functions MessageBoxW MessageBoxA MessageBox and the types: LPCWSTR LPCSTR wchar_t* char* and what is this f... W? Which of all do I have to use? I am very confused.

Share this post


Link to post
Share on other sites
Advertisement
Functions ending with W (wide?) returns LPCWSTR and functions ending with A (ANSI?) returns LPCSTR. So use the A version if you're using char*.

LPCSTR = char*
LPCWSTR = wchar_t*

Edit: compare the settings for debug and release, you probably have the release one set to unicode and not the debug one. If your project uses Unicode, the windows libs defaults to the W versions.

Share this post


Link to post
Share on other sites
Open project properties and under General settings change "Character set" to "Not set".

VS2005 by default uses Unicode character type (wchar_t) for WinAPI function calls. Thats why char* cannot be converted to LPCWSTR.

Also for every WinAPI function which takes string as paramter there extists two veriants - with A and with W suffix. Simple MessageBox actually is #define to real A or W function depending on project settings (using unicode - #define _UNICODE or not).

Previous studio versions didn't use unicode by default.

Share this post


Link to post
Share on other sites
But why there is such discrepancy between release and debug mode?The application compiles at debug, but it does not compile at release.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!