带有Xcode 6.3的OpenCV 3.0.0 [英] OpenCV 3.0.0 with Xcode 6.3
问题描述
我正在尝试使用Xcode编译简单的opencv代码,但出现编译错误.
opencv版本为3.0.0,Xcode版本为6.3(OS X 10.10.3)
在Xcode中,Apple LLVM 6.1语言C ++设置为:
c ++语言方言:C++11[-std=c++11]
c ++标准库:libc++
错误是:
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)
当我将c ++标准库更改为libstdc++
时,错误是:
/usr/local/include/opencv2/hal/defs.h:271:14: 'cstdint' file not found
有人可以告诉我如何在Xcode中使用opencv吗?我已经关注了很多论坛和指南,但仍然遇到相同的错误.
我遇到了同样的问题,要么是libc ++出现了未定义符号x86_64",要么是libstdc ++出现了找不到cstdint文件".
最终使它对我有用的是,我需要添加比以前更多的库,仅仅为一个简单的项目仅添加core,imgproc和highgui还是不够的. 所以我去了 Build Settings ,搜索了 Linking ,然后在 Other Linker Flags 中添加了很多内容: -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_lope -lopencv_video 我正在使用OpenCV 3.0.0和Xcode 6.4.将C ++标准库设置为 libc ++ ,将C ++语言方言设置为 C ++ 11 .希望这会有所帮助!
I'm trying to compile a simple opencv code using Xcode but I'm getting a compilation error.
The opencv version is 3.0.0 and Xcode version is 6.3 (OS X 10.10.3)
In Xcode, Apple LLVM 6.1 Language C++ settings are:
c++ Language Dialect : C++11[-std=c++11]
c++ Standard Library : libc++
the error is:
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 the error was:
/usr/local/include/opencv2/hal/defs.h:271:14: 'cstdint' file not found
Can someone show me how to get opencv work with Xcode? I've already followed lot of forums and guides but still getting the same error.
I had the same problem, either I got the "Undefined symbols x86_64" with libc++, or "cstdint file not found" with libstdc++.
What finally made it work for me was that I needed to add a lot more libs than I'm used to, it wasn't enough to add just core, imgproc, and highgui for even a simple project. So I went to Build Settings, searched for Linking, and in Other Linker Flags I added the whole lot: -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'm using OpenCV 3.0.0 and Xcode 6.4. C++ Standard Library set to libc++ and C++ Language Dialect C++11. Hope this helps!
这篇关于带有Xcode 6.3的OpenCV 3.0.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!