Wednesday, June 29, 2011 5:44 AM
I created an empty project with Visual C++ but realized afterwards that I really wanted a win32 project instead. I created a win32 project and copied all of the code to the new project. Whereas all of the code in the first project compiled error free, when I compile the new project, I get about 200 errors all saying roughly the same thing: "cannot convert const char to const wchar_t"
It took a while to track down the source of the problem, but I found it in a directory I had included. Here's the relevant snippet of the code:
#if defined(wchar_t) //this is if the compiler considers wchar_t as native type #define wchar_t unsigned short #endif
- Edited by longjetty7 Wednesday, June 29, 2011 6:32 PM
Wednesday, June 29, 2011 6:14 AM
You can change your project to compile on Unicode. Then,the preprocessor block will active.
You can change the following property.
Project -> Properties- > Configuration Properties-> General-> Project Defaults-> Use Unicode Character Set
Thanks and Regards Selvam http://www15.brinkster.com/selvamselvam/
Wednesday, June 29, 2011 10:47 AM
Enabling `wchar_t' as a native type does not define it as a macro, no more than `int' is a macro, and consequently its presence cannot be determined directly with use of the preprocessor. If you want to check whether `wchar_t' exists, regardless of macro or native type, use `#if defined(_WCHAR_T_DEFINED)' as documented here.
Wednesday, June 29, 2011 7:34 PMThanks for the help guys. As it turns out, the problem was that I was using the unicode character set. I changed the project properties to use no set at all and that ended up making inactive most of that header file that was giving me problems. I'm not sure what implications that will have for my project but at least those errors went away.
- Marked As Answer by Rob PanModerator Thursday, July 07, 2011 2:57 AM