在OS X上使用imshow时出错 [英] Error when using imshow on OS X

查看:698
本文介绍了在OS X上使用imshow时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在XCode中设置了 OpenCV2 ,但不幸的是 imshow 无法工作:

I have setup OpenCV2 in XCode but unfortunately imshow does not work:

Undefined symbols for architecture x86_64:
  "cv::imshow(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, cv::_InputArray const&)", 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)

我使用最新的XCode运行OS X 10.8.4。

I am running OS X 10.8.4 with latest XCode.

我已经在下面添加了几个图像来显示XCode和库中的设置。
到目前为止,其他函数似乎在OpenCV中正常工作,除了这一点。

I have attached a few images below to show the setup in XCode and the libraries. So far it seems that other functions work fine with OpenCV, except this.


推荐答案

我要走出去,说你用 OpenCV2 c $ c> libstdc ++ ,现在正在使用 libc ++ 支持来编译您的应用程序。

I'm going to go out on a limb and say that you compiled OpenCV2 with libstdc++, and are now compiling your application with libc++ support.

您需要使用相同的 C ++ 库来编译OpenCV2,否则将无法链接。

You need to compile OpenCV2 with the same C++ library, otherwise it will not be able to link.

if你做一个 nm 的OpenCV2库,如果它是用 libstdc ++ 编译,它将看起来像:

if you do an nm of the OpenCV2 library, if it was compiled with libstdc++, it will look like:

cv::imshow(std::string const&, cv::_InputArray const&)

,如果编译时使用 libc ++ ,它将如下所示:

while if it was compiled with libc++, it would look like:

cv::imshow(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, cv::_InputArray const&)

得到demangled符号do:

to get the demangled symbol do:

nm library | c++filt | grep cv::imshow

这篇关于在OS X上使用imshow时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆