OpenCV 3.0.0 with Xcode 6.3

I am trying to compile a simple opencv code using Xcode but I am getting a compile error.

Opencv version is 3.0.0 and Xcode version is 6.3 (OS X 10.10.3)

In Xcode for Apple LLVM 6.1, the C ++ language settings are:

C ++ Language Dialect: C++11[-std=c++11]

C ++ Standard Library: libc++

mistake:

Undefined symbols for architecture x86_64: "cv::imread(cv::String const&, int)", referenced from: _main in main.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

When I change the C ++ standard library to libstdc++

, then there was an error:

/usr/local/include/opencv2/hal/defs.h:271:14: 'cstdint' file not found

Can anyone show me how to get opencv with Xcode? I've followed many forums and tutorials already, but I still got the same error.

+3


source to share


1 answer


I had the same problem: either I got "Undefined x86_64 characters" with libc ++ or "cstdint file not found" with libstdc ++.

What ultimately got me working was that I needed to add a lot more libs than I was used to, it wasn't enough to add only core, imgproc and highgui even for a simple project. So, I went to the Build Settings , sought Binding , and other linker flags I've added a whole batch: -lopencv_calib3d -lopencv_core -lopencv_features2d -lopencv_flann -lopencv_highgui -lopencv_imgcodecs -lopencv_imgproc -lopencv_ml -lopencv_objdetect -lopencv_photo -lopencv_shape -lopencv_stitching -lopencv_superres -lopencv_ts - lopencv_video -lopencv_videoio -lopencv_videostab



I am using OpenCV 3.0.0 and Xcode 6.4. The C ++ Standard Library is installed on libC ++ and in C ++ Language C ++ 11 . Hope this helps!

+2


source







All Articles