Solved

MSVS2010 Release Build Error regarding CString::Compare wanting a wide character string

Posted on 2014-03-24
2
266 Views
Last Modified: 2014-03-25
I am trying to build a Release build of my C++ project (for the first time) within MSVS2010 and the compiler has flagged an error within CString::Compare
specifically

error C2664:  'ATL::CStringT<BaseType, StringTraits>::Compare' : cannot convert parameter 1 from 'const char [11]' to 'const wchar_t *'

I see that Character Set (General Tab of config properties of project properties) is set to Use Unicode Character Set.
Character Set for my Debug build was "Not Set" which worked fine.
Is this what I get for not using the TCHAR macro T("foolish string") all over the place.
0
Comment
Question by:supportoranges
2 Comments
 
LVL 19

Accepted Solution

by:
mrwad99 earned 500 total points
ID: 39952832
I am afraid so, yes.  If you don't need to use Unicode then I strongly suggest changing back to MBCS in the project settings, which I think is what is applied when "not set" is chosen.
0
 
LVL 1

Author Closing Comment

by:supportoranges
ID: 39952896
Ok.  There must be some reason Microsoft Release build defaults to Unicode so I will adjust my code to be more flexible when it comes to strings.  Thank you so much.  I really appreciate it!
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question