osx - C++11 headers missing on Mac OS X 10.8.2 (MountainLion) -


i'm new mac. have linux , windows c++11 source uses boost i'd build on mac. installed macport (should instead using homebrew?) 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 , sets makefile. when run make, seems cannot find normal c++11 headers such "chrono":

in file included ../src/test.cpp:10: ../src/test_private.hpp:33:10: fatal error: 'chrono' file not found #include <chrono>          ^ 1 error generated. 

indeed, when go looking c++ header files, see of them in /usr/include/c++/4.2.1/ newer files such chrono , thread missing.

is there package need install before can compile c++11 source code on mac?

xcode, apple supplied compiler/tools, comes 2 implementations of std::lib:

  1. gcc's libstdc++, version 4.2.
  2. libc++

the first very, old, , not support in c++11 such <chrono>. second supports c++11 quite well, can used clang, not gcc. clang comes xcode.

you need install command line tools after install xcode:

xcode-select --install 

Comments

Popular posts from this blog

java - Could not locate OpenAL library -

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

sorting - opencl Bitonic sort with 64 bits keys -