Solved

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

Posted on 2014-03-24
2
260 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
Comment Utility
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
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This article describes a technique for converting RTF (Rich Text Format) data to HTML and provides C++ source that does it all in just a few lines of code. Although RTF is coming to be considered a "legacy" format, it is still in common use... po…
For most people, the WrapPanel seems like a magic when they switch from WinForms to WPF. Most of us will think that the code that is used to write a control like that would be difficult. However, most of the work is done by the WPF engine, and the W…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
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…

744 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now