link error: opencv 2.4.2 libc++ (Bug #2412)
Xcode 4.5; cannot link opencv 2.4.2 with my project:
Undefined symbols for architecture x86_64:
"cv::imread(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int)"
without libc++ everything works (if disable all C++11 features in my project), but I really need them.
|duplicated by Bug #2319: OpenCV/iOS linkage with libc++ fails||Cancelled||2012-08-28|
Alex Fridlyand wrote:
this solved my problem.
So, users that want C++11 support can't install openCV with brew.
I had the same problem and just finished writing up my experience: http://richardt.name/blog/opencv-with-cxx11-on-os-x-10-8/.
In essence, it’s better to patch Google Test for libc++ (https://codereview.appspot.com/6332052/) than using the approach mentioned above.
The problem persists if you use Unix Makefiles instead of XCode: adding -std=c++11 -stdlib=libc++ to the CMAKE_CXX_FLAGS and CMAKE_EXE_LINKER_FLAGS then become annoying for CUDA compilation, because the nvcc frontend receives a -dumpspecs that is not supported by clang. On the other hand if changing the CUDA compiler to gcc it does not support the C++11 flags that are passed to it.