0

Within my bazel.rc file for the C++ Bazel build options, I have specified:

'build --cxxopt="-std=c++1y"'

When I try to change to build --cxxopt="-std=c++14", bazel Throws error of :

''build --cxxopt="-std=c++14"' is not an option'

, with a cursor below 4 in c++14. If I change the 4 to y (c++1y), it compiles with no problem. I tried adding 'std:make_unique' in my code (c++14 addition) , and it clearly does not compile (make _unique is not part of std) which is assume is complaining that c++14 is not set as the standard, hence no make_unique for me.

What is the latest supported version of C++ in bazel? More specifically, how do I enable C++14 / C++17 (and even C++2x) for Bazel build, it those are supported? Thanks!

NOTE: this is not the same as How to set C++ standard version when build with Bazel??. (I am not asking about cpp 11 and I am asking about a very specific toolchain -- GCC/g++) I am not using any of the tools suggested by that thread. I am using GCC / g++ and am restricted in not being able to use the tools suggested by the answer in the previous question, I've RTFMd and googled. Thanks in advance.

Dawot
  • 1
  • 2
  • Can you determine if Bazel refuses the C++14 option, or if it passes it to *gcc* which rejects it (which implies you have quite ancient *gcc*)? Ie. is this specifically a Bazel problem, or about the whole toolchain? – hyde Sep 21 '19 at 07:56
  • As a side note, *make_unique* is more of a consistency/convenience function. You can create the object with `new` and give it to `std::unique` in C++11 already. – hyde Sep 21 '19 at 07:58
  • @hyde: Thanks for the tip, the new trick would've been my workaround, but I was looking to upgrade my c++ version regardless. How would you determine whether this is a Bazel error / or gcc error? – Dawot Sep 21 '19 at 11:53
  • I am not familiar with Bazel, but often there are command line options to display versions and default configuration options (perhaps combined with some "verbose" option). I'f look for that. Also, check the *gcc* version (or versions) installed and its support for dofferent standard versions. – hyde Sep 21 '19 at 11:56

0 Answers0