将OpenCV添加到iOS应用程序
Adding OpenCV to iOS application
当我使用Hello World教程(见下面的链接)添加OpenCV时,我得到O链接器错误。我错过什么了吗?
http://docs.opencv.org/doc/tutorials/ios/hello/hello.html opencvioshelloworld
Undefined symbols for architecture armv7:
"std::string::operator=(char const*)", referenced from:
cv::BmpDecoder::BmpDecoder() in opencv2(grfmt_bmp.o)
cv::BmpEncoder::BmpEncoder() in opencv2(grfmt_bmp.o)
cv::PxMEncoder::PxMEncoder() in opencv2(grfmt_pxm.o)
cv::TiffEncoder::TiffEncoder() in opencv2(grfmt_tiff.o)
cv::SunRasterDecoder::SunRasterDecoder() in opencv2(grfmt_sunras.o)
cv::SunRasterEncoder::SunRasterEncoder() in opencv2(grfmt_sunras.o)
"___cxa_pure_virtual", referenced from:
vtable for cv::MatOp in opencv2(matop.o)
vtable for cv::BaseImageDecoder in opencv2(grfmt_base.o)
vtable for cv::BaseImageEncoder in opencv2(grfmt_base.o)
"vtable for std::exception", referenced from:
std::exception::exception() in opencv2(system.o)
std::exception::exception(std::exception const&) in opencv2(system.o)
NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
"___cxa_allocate_exception", referenced from:
cv::error(cv::Exception const&) in opencv2(system.o)
cv::PxMDecoder::readHeader() in opencv2(grfmt_pxm.o)
cv::RBaseStream::readBlock() in opencv2(bitstrm.o)
"std::string::operator[](unsigned long) const", referenced from:
cv::PxMDecoder::checkSignature(std::string const&) const in opencv2(grfmt_pxm.o)
"std::string::size() const", referenced from:
cv::Exception::formatMessage() in opencv2(system.o)
cv::error(cv::Exception const&) in opencv2(system.o)
cv::PxMDecoder::checkSignature(std::string const&) const in opencv2(grfmt_pxm.o)
cv::BaseImageDecoder::signatureLength() const in opencv2(grfmt_base.o)
cv::BaseImageDecoder::checkSignature(std::string const&) const in opencv2(grfmt_base.o)
看起来我的项目没有链接到c++运行时库。链接到运行库:
-
进入项目的"Build Phases"选项卡
-
选择"Link Binary With Libraries"一节
-
点击本节底部的"+"按钮
-
从出现的列表中选择"libc++"。"libstdc++. dylib"用于OpenCV 2.4.3,或"libstdc++. dylib"。
-
重建,一切正常。
相关文章:
- 在iOS应用程序中创建数据库
- 将文件从 iOS 应用程序加载到 C++ 对象中/<iostream>iOS 上的问题
- 来自另一个 IOS 应用程序的 IOS 应用程序命令
- 如何在iOS应用程序中锁定代码执行
- 避免在iOS应用程序上进行反向工程,这是可能的
- 将C++代码导入IOS应用程序
- 是否需要XCode才能在Visual Studio上使用C++开发iOS应用程序
- 向iOS应用程序添加64位切片会导致崩溃
- iOS应用程序在相同的内存地址获得EXC_BAD_ACCESS,但原因不同
- 如何构建使用 OpenCV 的 XCode 6 iOS 应用程序 - 未定义错误__cplusplus
- 使用 Unity 在 iOS 应用程序上发送电子邮件时出错
- 应用商店是否允许使用带有嵌入式 dylibs 的 iOS 8 应用程序
- 如何在 Windows 平台上开发 iOS 应用程序
- 在 iOS 应用程序中解压缩 bzip2
- 使用OpenCV在ios应用程序中检测圆圈
- ios应用程序访问文件与c++
- 通知从c++到UI在iOS应用程序
- 将OpenCV添加到iOS应用程序
- 文本渲染在iOS应用程序
- Visual Studio中的静态编译库(.lib)是否可以链接到iOS应用程序中?