How to resolve iOS Link errors with OpenCV

前端 未结 1 1636
萌比男神i
萌比男神i 2020-12-10 09:33

I\'m trying to add the newest version of openCV to my iOS project, but when I compile, I get about 30 link errors:

Example:

Undefined symbols for arc         


        
相关标签:
1条回答
  • 2020-12-10 10:24

    Check this: (assuming you are using LLVM compiler)

    Target > Build Settings > Apple LLVM Compiler 4.1 - language > C++ Standard Library
    try selecting

    libstdc++ (GNU C++ standard library)`  
    

    then try switch to

    libc++ (LLVM C++ standard library with C++11 support)
    

    libstdc++ seems to work for older builds of openCV, libc++ correct for newer builds. If you have it set wrong (either way) you will see these kinds of errors.

    If that isn't the cause, open the build setting side by side in each project and check every setting...

    I have been battling through this recently - see my question here, answers here and github sample here. The github project includes opencv framework compiled from current source a few days ago. Right now I am putting together a multi-target sample that links to a different version of the framework if compiling under 10.6/XCode4.2 or 10.7/XCode4.4+. [On github here]

    update

    As @mikewoz requested, you may need to run current openCV with libstdc++ to remain compatible with other frameworks. It is possible to make a current build with libstdc++ compatibility. For details see my answer to Mike's question here:

    OpenCV 2.4.3+ with libstdc++ for iOS?

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