can someone recommend a compiler that supports c++ 14 on the OS X platform? I'm studying programming and principles by Bjarne Stroustrup and need some assistance with acquiring the appropriate compiler for the context of the book (c++ 14).
Clang is a compiler created by Apple written over the LLVM compiler. It can be used to compile C, C++, Objective C/C++, OpenCL, CUDA, and RenderScript. Command-line developer tools install clang. Once command-line tools are installed, clang --version can be used to check if clang is installed.
To run the C program in MacOS we need a code editor and code compiler. The Code editor is used to write source code while the code compiler converts the source code into executable files. To write the source code Microsoft Visual Studio Code is used while to convert it into executable files we use command-line tools.
Done, the gcc version 4.2. 1 is installed on Mac OS X successfully.
You can run brew info gcc to get path where it is installed and get exact name of the binary by listing the directory. $ brew info gcc gcc: stable 11.2. 0 (bottled), HEAD GNU compiler collection https://gcc.gnu.org/ /usr/local/Cellar/gcc/11.2.
The best compiler for use on OS X is clang. C++14 is fully supported in clang as of 3.4: http://clang.llvm.org/cxx_status.html.
The current Xcode 6 betas come with a 3.4 based clang so you can just use that.
(Source: I am a compiler engineer working at Apple)
You should install Macports and then you have a choice of GCC 4.8 or 4.9 and Clang 3.5 or 3.6 by simply typing:
$ sudo port install clang-36
or
$ sudo port install gcc49
Note: you'll want to have Xcode installed first.
The standard compiler provided by apple is Clang. Here it claims it is c++14 aware:
http://clang.llvm.org/cxx_status.html#cxx14
To get it available I think the easiest way is to install Xcode.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With