warning: 'auto' type specifier is a C++11 extension [-Wc++11-extensions]

18,975

Solution 1

you want QMAKE_CXXFLAGS+=-Wno-c++11-extensions I suspect.

clang compiler documentation

pertinent part:

-Wfoo: Enable warning foo.

-Wno-foo: Disable warning foo.

Solution 2

According to qmake's repository history, the CONFIG += c++14 stanza was added in qmake version 5.4: https://codereview.qt-project.org/#/c/87831/

However, it seems Debian Jessie only has qmake version 5.3 (https://packages.debian.org/jessie/qt5-qmake)

As a workaround, you can use

QMAKE_CXXFLAGS += -std=c++14

or

QMAKE_CXXFLAGS += -std=gnu++14
Share:
18,975
KcFnMi
Author by

KcFnMi

Updated on June 19, 2022

Comments

  • KcFnMi
    KcFnMi almost 2 years

    I'm using Qt5 with Clang on Debian Jessie. To experiment with generic lambdas, in the .pro file there is:

    CONFIG += c++14
    

    And after building I got:

    warning: 'auto' type specifier is a C++11 extension [-Wc++11-extensions]
    

    To get rid of this obvious message I did:

    QMAKE_CXXFLAGS += -Wc++11-extensions
    

    But I keep getting the obvious message. Why? How to hide it?