I guess the question of the day is \"which\" c++ compiler is the default on mac?
If I do xcrun -find c++
it says it\'s in /Applications/Xcode.app/etc.
Short answer: call clang++ with -stdlib=libstdc++
, and the tr1
headers will be there.
Long answer:
The reason for your error and the 2 sets of C++ includes is that macOS/Xcode has two different C++ standard libraries you can build against: an old GNU libstdc++
, and the new and modern LLVM libc++
.
As of macOS 10.12 Sierra, the default is now libc++
and libstdc++
is deprecated. libstdc++
is quite old, v4.2.1, and predates C++11 (hence the tr1
headers). If you're going to be using this code long-term, it'd be worth the time to at least make it C++11 compliant (i.e. #include
)
Update: Xcode 10 no longer allows building against libstdc++. Either update your codebase to use standard C++11 headers, or use Xcode 9 if that's really not an option.