I have code C++ that I want to compile as a library using meson where I get 2 kinds of errors
- error C2440: 'initializing': cannot convert from 'const wchar_t [19]' to 'const PWCHAR' -note: Conversion from string literal loses const qualifier (see /Zc:strictStrings)
- error C2664: '... cannot convert argument 2 from 'const wchar_t [6]' to 'PWSTR note: Conversion from string literal loses const qualifier (see /Zc:strictStrings)
winnt.h uses typedef for wchar_t:
typedef wchar_t WCHAR;
typedef WCHAR *PWCHAR;
If I do this in my code I get Error C2440:
const PWCHAR Tokens[] = { L"A", L"B", L"C", L"D" };
If I change my code that error disappears:
const wchar_t * Tokens[] = { L"A", L"B", L"C", L"D" };
I know in C, the type of a string literal is array of char, but in C++, it's array of const char which causes this error. I also know it is possible to change Zc:strictStrings in VStudio. But since I compile my code with meson how would I get rid of that error using meson?