easyloggingpp icon indicating copy to clipboard operation
easyloggingpp copied to clipboard

codecvt_utf8_utf16 is deprecated and error compile with VS2017 if set ELPP_UNICODE macros

Open Ales999 opened this issue 6 years ago • 1 comments

Using current release (9.96.7). Error for this line:

std::locale elppUnicodeLocaleWindows(elppUnicodeLocale, new std::codecvt_utf8_utf16<wchar_t>);

Error | C4996 | 'std::codecvt_utf8_utf16<wchar_t,1114111,0>': warning STL4017: std::wbuffer_convert, std::wstring_convert, and the header (containing std::codecvt_mode, std::codecvt_utf8, std::codecvt_utf16, and std::codecvt_utf8_utf16) are deprecated in C++17. (The std::codecvt class template is NOT deprecated.) The C++ Standard doesn't provide equivalent non-deprecated functionality; consider using MultiByteToWideChar() and WideCharToMultiByte() from <Windows.h> instead. You can define _SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning. | SenderApp | c:\dev\myexamples\sharedmemory\include\easylogging++.cc | 741 |  

Ales999 avatar Jan 22 '19 15:01 Ales999

I solved this by putting #define _SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING at the beginning of easylogging++.h.

mocsa avatar Mar 27 '25 14:03 mocsa