Reputation: 20340
I'm new to Mac. I have some Linux and Windows C++11 source which uses Boost I'd like to build on this Mac. Installed MacPort (should I instead be using Homebrew?) then successfully ran commands such as:
sudo port install cmake
sudo port install boost
sudo port install openssl
sudo port install gcc49
sudo port install gcc_select
sudo port install --set gcc mp-gcc49
CMake correctly finds Boost 1.57.0 and sets up the makefile. But when I run make
, it seems it cannot find normal C++11 headers such as "chrono":
In file included from ../src/test.cpp:10:
../src/test_private.hpp:33:10: fatal error: 'chrono' file not found
#include <chrono>
^
1 error generated.
Indeed, when I go looking for the C++ header files, I see some of them in /usr/include/c++/4.2.1/
but newer files such as chrono
and thread
are missing.
Is there another package I need to install before I can compile C++11 source code on a Mac?
Upvotes: 0
Views: 2860
Reputation: 218750
Xcode, the Apple supplied compiler/tools, comes with two implementations of the std::lib:
The first is very, very old, and does not support anything in C++11 such as <chrono>
. The second supports C++11 quite well, but can only be used with clang, not gcc. clang comes with Xcode.
You will also need to install command line tools after you install Xcode:
xcode-select --install
Upvotes: 2