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

后端 未结 2 1600
逝去的感伤
逝去的感伤 2021-01-05 12:10

I get the compiler error complaining about when building a project incorporating OpenCV. Environment is Xcode 4.5 targeting iOS. It co

相关标签:
2条回答
  • 2021-01-05 12:42

    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.

    0 讨论(0)
  • 2021-01-05 12:45

    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.

    0 讨论(0)
提交回复
热议问题