I get the compiler error complaining about <ext/atomicity.h> when building a project incorporating OpenCV. Environment is Xcode 4.5 targeting iOS. It compiles fine for the simulator but fails when building for the device. Here’s the error text:
/Users/Nick/projects/ios/opencv2.framework/Headers/core/operations.hpp:65:16: fatal error: 'ext/atomicity.h' file not found
#include <ext/atomicity.h>
I’m using the opencv2.framework, builusing cmake, using the instructions here.
By default XCode 4.5 generates new projects to build using the
libc++ (LLVM C++ standard library with C++ 11 support). But OpenCV is expecting to be built against the GNUlibstdc++ (GNU C++ standard library).<ext/atomicity.h>is apparently a GNU extension and isn’t part of the LLVM libc++ standard library.In your project’s target settings, select
libstdc++ (GNU C++ standard library)for the C++ Standard Library setting.Very likely the atomicity.h requirement could be factored out of opencv or otherwise done in a LLVM libc++ compatible way. I didn’t explore this but would be interested if anyone had insight on how this could be done.