From 43bf20da45940f3e64513f5ff0b434400752be3f Mon Sep 17 00:00:00 2001 From: Vasily Date: Wed, 23 Jan 2019 20:43:44 +0100 Subject: [PATCH] Fix msvc and clang-msvc warnings with C++17 The codecvt header has been deprecatd for C++17, but no replacement has been specified in the standard. It is possible to use the Windows specific MultiByteToWideChar() and WideCharToMultiByte() from instead, however the codecvt header still works so there's no reason to change it until a proper replacement has been specified in the standard. It is additionally necessary to manually set the standard for clang-msvc to C++17. --- advancedSettings.pro | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/advancedSettings.pro b/advancedSettings.pro index e66e72e..3b9f7ff 100644 --- a/advancedSettings.pro +++ b/advancedSettings.pro @@ -22,6 +22,10 @@ TEMPLATE = app QMAKE_CXXFLAGS_WARN_ON -= -W3 #C4127 was in a third party file with no way to turn off. QMAKE_CXXFLAGS += /W4 /wd4127 + # The codecvt header being used in AudioManagerWindows.cpp is deprecated by the standard, + # but no suitable replacement has been standardized yet. It is possible to use the Windows + # specific MultiByteToWideChar() and WideCharToMultiByte() from + DEFINES += _SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING !*clang-msvc { #win32-clang-msvc is unable to correctly build the first time #with warnings as errors on. There seems to be an issue with the moc_predefs.h @@ -31,6 +35,10 @@ TEMPLATE = app } } +win32-clang-msvc{ + QMAKE_CXXFLAGS += /std:c++17 +} + *g++* { QMAKE_CXXFLAGS += -Werror }