You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
std::wstring s_2_ws(const std::string& s)
{
if (s.empty())
return{};
const auto s_length = static_cast<int>(s.length());
auto buf = std::vector<wchar_t>(s_length);
const auto wide_char_count = MultiByteToWideChar(CP_UTF8, 0, s.c_str(), s_length, buf.data(), s_length);
return std::wstring(buf.data(), wide_char_count);
}
The function above would compile with older versions for GCC (9.3.0 on kunbuntu 20.04) but fails to compile in above listed Windows7 environment with an error during linking:
multiple definition of `mio::detail::win::s_2_ws(std::__cxx11:basic_string<char, std::char_traits<char>, std::allocator<char> > const &);
...
first defined here
and it lists the same location in the hpp file.
The solution is simple: make the function s_2_ws inline. That gets rid of the error.
inline std::wstring s_2_ws(const std::string& s)
{
if (s.empty())
return{};
const auto s_length = static_cast<int>(s.length());
auto buf = std::vector<wchar_t>(s_length);
const auto wide_char_count = MultiByteToWideChar(CP_UTF8, 0, s.c_str(), s_length, buf.data(), s_length);
return std::wstring(buf.data(), wide_char_count);
}
The problem exists in both the single include as well as regular ipp file.
The text was updated successfully, but these errors were encountered:
Windows 7, mingw (MSYS2)
gcc 10.2.0
in mio.hpp, line 798:
The function above would compile with older versions for GCC (9.3.0 on kunbuntu 20.04) but fails to compile in above listed Windows7 environment with an error during linking:
and it lists the same location in the hpp file.
The solution is simple: make the function s_2_ws inline. That gets rid of the error.
The problem exists in both the single include as well as regular ipp file.
The text was updated successfully, but these errors were encountered: