Linker errors on Xcode 4.5.2 with OpenCV 2.4.3

Did anyone manage to link an Unity plugin for iOS including OpenCV 2.4.3 (from http://opencv.org/downloads.html) with xCode 4.5.2?

I managed to use the opencv2.framework in a project outside Unity. But when included inside the Unity-iPhone.xcodeproj it does not link anymore with an error Like this:

Undefined symbols for architecture armv7:
  "std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_string(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
      cv::Exception::Exception(int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int) in opencv2(system.o)
      cv::Exception::Exception(cv::Exception const&) in opencv2(system.o)
...

Then If I set the target > build settings > Apple LLVM compiler 4.1 - Language > C++ Standard Library to libc++ (LLVM C++ standard library with C++11 support)
then OpenCV links just fine. But then Unity’s libiPhone-lib.a is not linking properly anymore:

Undefined symbols for architecture armv7:
  "std::string::push_back(char)", referenced from:
      GetParameter(UTF16String&, int&, bool) in libiPhone-lib.a(TextFormatting.o)
  "std::string::assign(char const*, unsigned long)", referenced from:
      Append(char const*, char const*) in libiPhone-lib.a(Word.o)
      DebugTextLineByLine(char const*) in libiPhone-lib.a(LogAssert.o)
...

I was wondering if anyone managed to get the 2 at the same time. Thanks!

I have same problem with metaioSDK and OpenCV 2.4.3 including. MetaioSDK dose not support lib++ option for C++ Standard Language, which is the only option OpenCV lib accepted. I’m desperate for any solution of this.

I found a way to get it working by syncing the OpenCV project right before the switch to c++11 and building it manually.

You need to have the xCode command line tools installed first (in xCode > Preferences > Downloads).
In a new terminal do:

cd ~/my_working _directory
git clone https://github.com/Itseez/opencv.git
# Reset to just before the switch to c++11
git reset d9d4e8df6f
cd /
sudo ln -s /Applications/Xcode.app/Contents/Developer Developer
cd ~/my_working_directory
mkdir build
cd build
../opencv/ios/configure-device_xcode.sh
xcodebuild -sdk iphoneos -configuration Release -target ALL_BUILD
xcodebuild -sdk iphoneos -configuration Release -target install install
# For some reason the library files are not in the lib folder
# so we need to copy them manually
cp lib/Release/*.a ../OpenCV_iPhoneOS/lib

…/OpenCV_iPhoneOS is now ready to be dragged and drop to your unity xCode project.