Fix for using C++11 features with OSX 10.7 deployment target


#1

I’m sure this may be answered elsewhere but I couldn’t find it.

If you want to use C++11 features in your application and support OSX down to 10.7 you need to…

  • Set ‘OSX Deployment Target’ to ‘10.7’
  • Set ‘C++ Library’ to ‘LLVM libc++’

…in the Config>Xcode>Debug/Release Projucer settings.

Explanation here: https://groups.google.com/a/chromium.org/forum/#!topic/crashpad-dev/87u4dce7c9I

In particular:

“Apple provides a C++11 standard library in libc++. They also ship a very old version of libstdc++ that has no C++11 support. The compiler driver defaults to libstdc++ when the deployment target is lower than 10.9, so by setting the deployment target to 10.7, you’ve inadvertently instructed the compiler driver to disable the C++11 library.”

By only setting the ‘OSX Deployment Target’, the minimum that will build C++11 features is 10.9.

Hopefully this may help someone else!


#2

Thank you!