Important: Please read the Qt Code of Conduct -

CONFIG += is ignored?

  • I'm new to Qt and am using Qt 5.12 on Linux. I am familiarizing myself with how Qt does things. Something I've noticed it the in my, the CONFIG +={values} seems to be ignore. For example, I can place this in there:


    yet my project still builds without any errors.

    Why is this?

  • Lifetime Qt Champion

    @Andy-Turfer what happens if you place valid values there?

  • @aha_1980 I'm not sure, which is why I have trying invalid values. CONFIG += C++11 seems to do the same thing as CONFIG += C++17. I'll try to write a small program that uses something C++17 specific.

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    AFAIK, unless you have a feature corresponding to what you put in CONFIG, what you add to it won't change anything.

    See Adding New Configuration Features in Qt's documentation.

  • @SGaist Thanks - that seems to make sense. I just created a Qt Console application using with the following in my

    QT -= gui
    CONFIG += c++17 console
    CONFIG -= app_bundle
    SOURCES += \
    qnx: target.path = /tmp/$${TARGET}/bin
    else: unix:!android: target.path = /opt/$${TARGET}/bin
    !isEmpty(target.path): INSTALLS += target

    The console application uses std::string_view:

    #include <QCoreApplication>
    #include <iostream>
    #include <string_view>
    int main(int argc, char *argv[])
        QCoreApplication a(argc, argv);
        std::string_view sv = "ABCD";
        std::cout << sv << std::endl;
        return a.exec();

    This compiles and runs. If I change C++17 back to the default C++11, the build fails (indicating C++17 is working).

    The line with CONFIG += JKFLDJFLKJDSKFJDS does absolutely nothing.

    Thanks for the answer, I'll read through the "Adding New Configuration Features" from the docs.

  • Lifetime Qt Champion

    @Andy-Turfer which Qt version are you using?

    It has been CONFIG+=c++1z forever. c++17 was introduced as alias in 5.12, IIRC.

Log in to reply