小编Hie*_*ham的帖子

OpenCV C++ 在 Macbook M1 芯片中给出架构 arm64 错误

我按照本教程在 Macbook M1 中构建了 OpenCV-4.5.2:https: //sayak.dev/install-opencv-m1。它在 Python 中工作正常,但当我在 C++ 中使用时

#include <iostream>
#include <opencv2/core.hpp>
#include <opencv2/imgcodecs.hpp>
#include <opencv2/highgui.hpp>

int main()
{
    cv::Mat img = cv::imread("avatar.jpeg");
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

它在 cv::Mat 中给出错误

Undefined symbols for architecture arm64:
  "cv::Mat::~Mat()", referenced from:
      _main in main.cpp.o
  "cv::imread(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int)", referenced from:
      _main in main.cpp.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[3]: *** [imgproc] Error 1 …
Run Code Online (Sandbox Code Playgroud)

c++ macos opencv arm64 apple-m1

6
推荐指数
1
解决办法
3505
查看次数

标签 统计

apple-m1 ×1

arm64 ×1

c++ ×1

macos ×1

opencv ×1