欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Android studio opencv报错undefined reference to 'cv::imwrite(cv::String const&, c

程序员文章站 2022-06-22 19:57:49
...

最近研究opencv识别银行卡号,集成opencv的时候ndk编译报错如下:

E:\codingPath\BankCardOCR\app/src\main\cpp\CardOcr.cpp:229: error: undefined reference to 'cv::imwrite(cv::String const&, cv::_InputArray const&, std::__ndk1::vector<int, std::__ndk1::allocator<int> > const&)'

Android studio opencv报错undefined reference to 'cv::imwrite(cv::String const&, c

网上很多文章说是头部文件引入的问题,但是查看代码,引入没有问题。

猜想可能是ndk版本的原因:

1.查看当前使用的ndk版本,工程名上右键选择“open moudle setting”,查看ndk的版本为20

 

Android studio opencv报错undefined reference to 'cv::imwrite(cv::String const&, c

Android studio opencv报错undefined reference to 'cv::imwrite(cv::String const&, c

 

2.打开设置,查看安装的ndk

Android studio opencv报错undefined reference to 'cv::imwrite(cv::String const&, c

Android studio opencv报错undefined reference to 'cv::imwrite(cv::String const&, c

 

3.安装ndk-16,操作如下,等待安装完成

Android studio opencv报错undefined reference to 'cv::imwrite(cv::String const&, c

 

4.设置当前工程使用的ndk

Android studio opencv报错undefined reference to 'cv::imwrite(cv::String const&, c

5.重新build下,ok了