2

dummy.cpp:

#include <functional>

void foo(std::function<void(void)> f) {}

And the compile command:

clang++  -c  -mmacosx-version-min=10.6  -std=c++11  dummy.cpp -o dummy.o

That fails with various errors (std::function is unknown). However, without -mmacosx-version-min=10.6, it works fine.

Why is that? Can I somehow get C++11 support with -mmacosx-version-min=10.6?


My current workaround: Use Boost instead for such containers, e.g. boost::function. Other syntactic stuff from C++11 can be used without issues.

Albert
  • 65,406
  • 61
  • 242
  • 386
  • possible duplicate of [How do I get back c++0x/c++11 support for Mac OS X 10.6 deployment using Xcode 4.6.3](http://stackoverflow.com/questions/14494513/how-do-i-get-back-c0x-c11-support-for-mac-os-x-10-6-deployment-using-xcode-4) – Anya Shenanigans Feb 08 '14 at 17:20
  • @Petesh: Is it? I'm not using `-stdlib=libc++`. It should all be header-only, shouldn't it? – Albert Feb 08 '14 at 17:22
  • If you're using XCode 5 (which you probably are), then it uses that libc++ by default. – Anya Shenanigans Feb 08 '14 at 17:24
  • @Petesh: I used that compile command as-is (i.e. in console). – Albert Feb 08 '14 at 17:40
  • Marshal Clow has some good reading on Apple's runtime change. See [What’s up with TR1? (and C++11, and libc++)](http://cplusplusmusings.wordpress.com/author/mtclow/). – jww Feb 10 '14 at 04:30
  • @noloader: How is that related? – Albert Feb 10 '14 at 10:28

0 Answers0