在OSX 10.8上的xcode 5中无法使用imshow

时间:2015-05-06 12:21:34

标签: c++ xcode macos opencv imshow

我有点不解,因为我无法使用opencv库中的imshow。我在opencv中使用了很多其他函数,但是当我想显示矩阵/图像时,我得到了这个错误。

Undefined symbols for architecture x86_64:
  "cv::namedWindow(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int)", referenced from:
      _main in main.o
  "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)

抛出此错误的代码/函数是:

cvStartWindowThread();
namedWindow("DisplayImage", WINDOW_AUTOSIZE);
imshow("Display Image", img_bgr);

其中img_bgr是我想要的矩阵。

我正在使用Xcode 5.1.1开发OSX 10.8.5,并通过this walkthrough安装了opencv-2.4.10。

任何人都有一个想法,可以帮助我为什么不能调用上述功能?我搜索了有关这个问题的线索,但似乎都没有令人满意。

编辑:

现在已经卸载并安装了两次OpenCV。一次使用Cmake本身(作为应用程序),一次使用this tutorial。没有任何结果仍然得到相同的错误。 没有人有想法吗?

1 个答案:

答案 0 :(得分:0)

经过几次试验/小时的故障排除后,我终于开始运行了。这是一种压路机战术,但无论如何。我刚刚格式化了我的笔记本电脑并在一个新的分区上安装了10.10 Yosemite。 在使用OpenCV的this之后,最初building issuesexplained here它现在可以完美运行。