Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to silence gcc warning against c++17 features?

Tags:

c++

gcc

c++17

I self built gcc 7 to try out some new c++17 features.

When I built the code, I saw hundred lines of warnings, saying certain features are available only when -std=c++1z (I have already specified -std=c++1z in the build command line and I tried gnu++1z too)

I want to silence this warning. when using clang 4, there was an option -Wno-c++1z-extensions

but this option is not recognized by gcc.

like image 306
Bill Yan Avatar asked Mar 10 '23 15:03

Bill Yan


1 Answers

I have root caused the reason for my problem.

It's because I set -std=c++17 with cmake. and I also have included Qt5. Qt5 settings overwrote my -std=c++17. With make VERBOSE=1, I could see both -std=c++17 and -std=c++14.

This confuses the compiler.

the problem is related to https://gitlab.kitware.com/cmake/cmake/issues/16468

like image 179
Bill Yan Avatar answered Mar 20 '23 15:03

Bill Yan