I’m trying to compile legacy code in Qt Creator using the Microsoft Visual C++ Compiler 10.0 (x86), and I am getting the classic error:
cannot convert parameter 1 from ‘char *’ to ‘LPCWSTR’
Rather than edit the code (something I should not be doing, it is a 3rd party SDK), the solution is to go into Visual Studio general settings and change the character set to
‘Use Multi-byte character set’
However, I’m not using the Visual Studio IDE and don’t have that setting. So I need to know what setting that actually does in terms of code/compilation. Does it set a compiler flag or #define something? How can I achieve the same in Qt Creator?
A quick check in Visual Studio and this is what I found:
If the option is Use Unicode Character Set, you’ll have these two compiler options:
However, if it’s Use Multi-Byte Character Set, you’ll have:
So you either need to update the command line and change from
/D "_UNICODE" /D "UNICODE"to/D "_MBCS"or #define somewhere an_MBCSsymbol.