Nominate our 2022 Qt Champions!

How can I make changes to the effective qmake call?

  • Hi,

    one of the samples shows the Effective make call but I need to change its contents (the contents of the make file...). Specifically I need to pass -std=c++14.

    How is this done? Where the make file?


  • Hi! You can add CONFIG += c++14 to your *.pro file.

  • Ok, I added CONFIG += c++14 to my *.pro file, but now I am getting compiler errors like "/Users/juandent/Qt5.5.1/5.5/clang_64/lib/QtCore.framework/Headers/qstring.h:739: error: no type named 'u16string' in namespace 'std'
    static inline QString fromStdU16String(const std::u16string &s);"
    in code like:

    #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;

    ?? This does not occur if I use CONFIG += c++11


  • What is strange about this error is that even if I #include<string>, the compiler complains that u16string does not exist in std namespace...

    which is false!!
    Is something corrupt??

    Any ideas?

  • Lifetime Qt Champion


    Are you running OS X ? What version of Qt ?

  • Hi,

    Qt Creator version 3.5.1 (open source) based on Qt 5.5.1 (Clang 6.0 (Apple), 64 bit).

    OS X version 10.11.2


  • Lifetime Qt Champion

    Also Qt 5.5.1 ? Or 5.6.0 Beta ?

    Can you show your .pro file ?

  • Hi,

    Yes Qt 5.5.1

    The .pro is:

    TEMPLATE = app

    HEADERS = bookdelegate.h bookwindow.h initdb.h
    RESOURCES = books.qrc
    SOURCES = bookdelegate.cpp main.cpp bookwindow.cpp
    FORMS = bookwindow.ui

    CONFIG += c11
    CONFIG += c++14

    QT += sql widgets widgets

    target.path = $$[QT_INSTALL_EXAMPLES]/sql/books
    INSTALLS += target

    wince {
    CONFIG(debug, debug|release):sqlPlugins.files = $$QT_BUILD_TREE/plugins/sqldrivers/d4.dll
    CONFIG(release, debug|release):sqlPlugins.files = $$QT_BUILD_TREE/plugins/sqldrivers/
    sqlPlugins.path = sqldrivers
    DEPLOYMENT += sqlPlugins

  • Lifetime Qt Champion

    It should be CONFIG += c++11

    Also check that you are using the clang mkspec

  • Hi,

    Yes with c++11 it works but I want to use c++14, and I know Xcode 7.2 supports c++14 ... since under the covers the compiler is doing the compiling, why can't I instruct it to work in C++ 14 mode?

    What do you mean by clang mkspec? Where do I find that?

    Thank you very much for your help so far!!

  • Lifetime Qt Champion

    Go to Qt Creator's preferences and take a look at the Kit, you should see there the mkspec. If empty look at the Qt Version used for the Kit but AFAIK, it should be clang by default.

  • what about using C++14? -- is it not possible?


  • Lifetime Qt Champion

    It should be yes. Usually only "CONFIG += c++14" should be enough.

  • Qt mkspec is empty but Qtversion is Qt 5.5.1 clang 64bit

    ?? Still have the problem


  • Hi Qt Champ!

    I found the answer finally!!

    The solution is: IN ORDER to use C++14 you must also enable C++11, like so:

    CONFIG+= c++11
    CONFIG+= c++14

    That solves all the problems!!

    Thanks for the help!


  • Lifetime Qt Champion

    Great !

    Then please mark the thread as solved using the "Topic Tool" button so other forum users may know a solution has been found :)

Log in to reply