简体   繁体   中英

How to set C++ language standard in C++ Builder

Today we worked on a piece of code that requires either C++14 or C++17. My colleague used C++Builder for the code editing, and also wanted to try to compile the code piece with it.

We could not find the setting where one sets the C++ language standard. What we found by googling was that C++builder has a "classic compiler" that supports only parts of C++11 and a "clang-based compiler" that supports up to C++17. We found a check box for enabling/disabling the "classic compiler" in the project settings, but no project setting for selecting the language standard explicitly (to switch between C++14 and C++17). Is there something like that? Where?

The version that we have is C++Builder 10.2.

We also tried to explicitly set an additional compiler option -std=c++14 for the clang-based compiler but this option was rejected ("unknown value c++14").

The ISO C++, 10.4 Sydney C++Builder and Clang version information is as follows:

http://docwiki.embarcadero.com/RADStudio/Sydney/en/Clang-enhanced_C%2B%2B_Compilers

Compiler    Platform        Clang Version   LLVM Version
BCC32C      32-bit Windows  5.0             5.0
BCC32X      32-bit Windows  5.0             5.0
BCC64       64-bit Windows  5.0             5.0
BCCIOSARM   32-bit iOS      3.3             3.3
BCCIOSARM64 64-bit iOS      3.3             3.5
BCCAARM     Android         3.3             3.3

https://clang.llvm.org/cxx_status.html

Clang 3.3 and later implement all of the ISO C++ 2011 standard.

Clang 3.4 and later implement all of the ISO C++ 2014 standard.

Clang 5 and later implement all the features of the ISO C++ 2017 standard.

David Millington, Product Manager for C++Builder, also keeps the Embarcadero C++Builder information updated on the C++ Reference site at https://en.cppreference.com/w/cpp/compiler_support

You can look at the different ISO C++ language releases to see what many compilers support in their compiler releases.

Hans Passant has posted a comment to my question which links to New in RAD Studio 10.3: C++17, asynchronous C++ code completion, and more , thank you.

From this link I learn:

  1. C++ Builder 10.2 does not include any support for C++14 nor C++17.
  2. C++ Builder 10.3 supports C++17 only when compiling 32 bit windows binaries. Support for C++14 is only available in the sense that C++17 is "with some small exceptions, a superset" of C++14. Which means, you cannot select the desired language standard used for compilation.
  3. C++ Builder 10.4 seems to support C++17 also for 64 bit windows. It is unclear if and how the language standard to use can be selected.

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