Win32 debug build error on incompatible type
Reproduced it on two separate Windows 11 machines. This line is breaking the Components project in Visual Studio, Debug configuration, x64:
debugging.cpp(191,17): error C2664: 'void OutputDebugStringW(LPCWSTR)': cannot convert argument 1 from 'const _Elem *' to 'LPCWSTR'
debugging.cpp(191,17): error C2664: with
debugging.cpp(191,17): error C2664: [
debugging.cpp(191,17): error C2664: _Elem=char
debugging.cpp(191,17): error C2664: ]
(compiling source file '../../components/debug/debugging.cpp')
debugging.cpp(191,44):
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or parenthesized function-style cast
C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\um\debugapi.h(61,1):
see declaration of 'OutputDebugStringW'
debugging.cpp(191,17):
while trying to match the argument list '(const _Elem *)'
with
[
_Elem=char
]
The tooltip has a slightly different error:
E0167: argument of type "const char *" is incompatible with parameter of type "LPCWSTR"(aka "const WCHAR *")
The error is caused by !5085 (4ea6374a). This change makes OutputDebugString choose OutputDebugStringW, which expects std::wstring.
Steps to Reproduce
- Open Visual Studio 2022.
- Switch to Debug configuration.
- Switch to x64.
- Build
components.vcxproj.
System Information
- OpenMW Version: latest master
- Operating System & Version: Windows 11 (10.0.26200 Build 26200)
Edited by Aussiemon