Qt Creator 5.5 and C++ wchar_t type

  • Hi, I'm a newbie to Qt.

    I have some trouble in showing a Korean character with wchar_t type in Qt Project's console.

    My code is simple like this.

    int main(int argc, char *argv[])
        QCoreApplication a(argc, argv);
        wchar_t letter = L'가';
        wcout << letter << endl;
        return a.exec();

    The problem is that it shows nothing but a cursor in the console window.
    Actually, I found the value resides in memory, only not showing it.

    By the way, when I go with a English letter, it shows normally.

    wchar_t = L"a";

    In MSVC, I solved this by using C++ locale.


    but in Qt there is no imbue for wcout.

    Does Qt even support C++11 fully?
    or, do you guys have any other solutions for this?

  • Lifetime Qt Champion


    Maybe setCodecForLocal would help.

    You can use C++11 without any problem even C++14 if your compiler supports it.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.