OpenCV build issue, can't find ext/atomicity.h OpenCV build issue, can't find ext/atomicity.h xcode xcode

OpenCV build issue, can't find ext/atomicity.h


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 GNU libstdc++ (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.


I think it is the other way around. Looking at the output of the python script that builds opencv2.framework I get this:

-- C++ flags (Release): -stdlib=libc++ -headerpad_max_install_names -fvisibility=hidden -fvisibility-inlines-hidden -fPIC -DNDEBUG -O3 [...]

which is most likely not what you want. So you need to compile the framework with libstdc++ or compile your app with the proper lib. From what I see I get problems when building my apps with libc++ but that might be me.