c++ - No type named 'u16string' in namespace 'std' -


i'm using qt 5.5.0.

when compile program, shows “no type named 'u16string' in namespace 'std'”. interesting part compiled in past, why failing now? seems trouble qstring.h.

how fix it? here error happen

#ifndef qstring_h  #define qstring_h  #if defined(qt_no_cast_from_ascii) && defined(qt_restricted_cast_from_ascii)  #error qt_no_cast_from_ascii , qt_restricted_cast_from_ascii must not defined @ same time  #endif   #include <qtcore/qchar.h>  #include <qtcore/qbytearray.h>  #include <qtcore/qrefcount.h> #include <qtcore/qnamespace.h>  #include <string>  #if defined(q_os_android) // std::wstring disabled on android's glibc, bionic lacks features  // libstdc++ checks (like mbcslen). namespace std { typedef basic_string<wchar_t> wstring; } #endif  #if defined(q_compiler_unicode_strings) || defined(q_qdoc)     static inline qstring fromstdu16string(const std::u16string &s);     inline std::u16string tostdu16string() const;     static inline qstring fromstdu32string(const std::u32string &s);     inline std::u32string tostdu32string() const;  #endif  

to fix it:

  1. as qt on mac built clang, in "qt creator" -> "preferences" -> "kits", should set "compiler" clang.

  2. instead of writing "qmake_cxxflags += -std=c++11", add below config .pro file:

    config += c++11 

https://forum.qt.io/topic/56064/solved-problem-with-qt-5-5/11


Comments