_UNICODE is a reserved env variable on Windows
jgeudens opened this issue · 2 comments
Hi, I'm using your library muparser in a project of mine. It has been working great. I'm using the latest version v2.3.3.
Recently I have updated my project to Qt6.2.3 and started using a newer compiler for my Windows builds. The new compiler version is gcc version 11.2.0 (x86_64-posix-seh-rev1, Built by MinGW-W64 project)
After the update, I get compiler errors about std::strings with wchar that aren't compatible with char. It appears that the ENABLE_WIDE_CHAR is enabled by accident.
It googled a bit and it appears that _UNICODE
is a reserved environment variable on Windows for enabling/disabling some unicode support in the Windows headers. I'm not sure what part of my toolchain is actually setting _UNICODE, but when I refactor _UNICODE to _UNICODE_SUPPORT in the muparser library code, the compilation is ok again.
My recommendation would be to place an #undef _UNICODE in front of the muparser includes if you want to link with a non unicode build in a unicode environment.
The purpose of using this variable is to be able to pick up the OS setting. The problem here is that the _UNICODE is defined and a non unicode built of muparser is linked. That is something outside of my control.
Ok, thank you for the information. I will convert my code to unicode.