c++c++11nullptrc++builder-10.1-berlin

C++ Builder nullptr keyword "Undefined"


In C++ Builder (Berlin) the editor's syntax highlighter shows nullptr as a reserved word. But when compiling I get the error:

Undefined symbol 'nullptr'

nullptr was added to the C++11 standard and as far I know, C++ Builder Berlin supports C++11. I have been browsing the C++ Compiler options but can't find anything related to selecting what C++ standard to use.

Is nullptr not supported in C++ Builder Berlin and the highlighter is just buggy? Or can I turn on C++11 support somewhere?


Solution

  • as far I know, C++ Builder Berlin supports C++11.

    To be more accurate, only its Clang-based compilers support C++11. The "classic" Windows 32-bit compiler does not.

    When compiling for Windows 32-bit, you can specify in the Project Options whether to use the Classic or Clang compiler. Per Embarcadero's documentation:

    How to use the Clang-based compiler for Windows 32-bit projects:

    BCC32C and BCC32X do not replace BCC32, RAD Studio gives you the option to choose the compiler for each of your projects. BCC32 is the default C++ compiler for 32-bit Windows.

    To enable BCC32C or BCC32X for a specific project, select Project > Options > C++ Compiler and disable the Use 'classic' Borland compiler option under Classic Compiler.

    The IDE will now use the Clang-enhanced Win32 compiler.