Will the 2nd -std=gnu++14 override the 1st -std=c++17 ?


A naive concept question: while I'm building a file/folder, for instance, here, I'm trying to build protobuf from source, one of the building commands is:



[ 46%] Building CXX object CMakeFiles/libprotobuf.dir/src/google/protobuf/io/gzip_stream.cc.o
/usr/bin/c++ -DGOOGLE_PROTOBUF_CMAKE_BUILD -DHAVE_ZLIB -I....../protobuf/build -I....../protobuf/src -I....../protobuf/third_party/googletest/googlemock -I....../protobuf/third_party/googletest/googletest -I....../protobuf/third_party/googletest/googletest/include -I....../protobuf/third_party/googletest/googlemock/include -I....../protobuf/third_party/utf8_range -I....../protobuf/third_party/abseil-cpp -std=c++17 -fPIC -O3 -DNDEBUG -fvisibility=hidden -fvisibility-inlines-hidden -std=gnu++14 -o CMakeFiles/libprotobuf.dir/src/google/protobuf/io/gzip_stream.cc.o -c ....../protobuf/src/google/protobuf/io/gzip_stream.cc


Will the 2nd -std=gnu++14 override -std=c++17??

Thank you ...
The man gcc either does not mention, or hides the info from casual reader.

If https://stackoverflow.com/questions/52874345/is-gcc-flags-repetition-and-ordering-important is true, then the last occurrence wins.


You can test. Create minimal programs that depend on certain version. For example, with auto in it. Then try both orders, e.g.
A. -std=c++98 -std=c++14
B. -std=c++14 -std=c++98
Only one of those should succeed.
Topic archived. No new replies allowed.