简体   繁体   中英

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

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?

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

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

clang compiler documentation

pertinent part:

-Wfoo : Enable warning foo .

-Wno-foo : Disable warning foo .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM