编译 opencv 框架时出现未知错误:未定义的符号:"_CGImageDestinationCreateWithURL"

Unknown error compiling opencv framework: Undefined symbols: "_CGImageDestinationCreateWithURL"

本文关键字:未定义 符号 CGImageDestinationCreateWithURL 错误 框架 opencv 未知 编译      更新时间:2023-10-16

Xcode给了我以下错误,我真的不知道该怎么办,这让我抓狂。我正在导入一个OpenCV框架,所以可能存在问题或与编译器有关的问题。有人能告诉我该做什么或搜索什么吗?

      Undefined symbols:   "_CGImageDestinationCreateWithURL", referenced from:
      cv::ImageIOEncoder::write(cv::Mat const&, std::vector<int, std::allocator<int> > const&)in OpenCV(grfmt_imageio.o)   "_CGImageDestinationAddImage", referenced from:
      cv::ImageIOEncoder::write(cv::Mat const&, std::vector<int, std::allocator<int> > const&)in OpenCV(grfmt_imageio.o)   "_CGImageSourceCreateImageAtIndex", referenced from:
      cv::ImageIODecoder::readHeader()      in OpenCV(grfmt_imageio.o)   "_CGImageDestinationFinalize", referenced from:
      cv::ImageIOEncoder::write(cv::Mat const&, std::vector<int, std::allocator<int> > const&)in OpenCV(grfmt_imageio.o)   "_CGImageSourceCreateWithURL", referenced from:
      cv::ImageIODecoder::readHeader()      in OpenCV(grfmt_imageio.o) ld: symbol(s) not found collect2: ld returned 1 exit status

为了未来的访客(比如我;-)),我报告了Gustavo的自我回答:

添加"ImageIO.framework"到"链接的框架和库"