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

最近研究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 > const&)'

Android studio opencv报错undefined reference to 'cv::imwrite(cv::String const&, c_第1张图片

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

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

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

 

Android studio opencv报错undefined reference to 'cv::imwrite(cv::String const&, c_第2张图片

Android studio opencv报错undefined reference to 'cv::imwrite(cv::String const&, c_第3张图片

 

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

Android studio opencv报错undefined reference to 'cv::imwrite(cv::String const&, c_第4张图片

Android studio opencv报错undefined reference to 'cv::imwrite(cv::String const&, c_第5张图片

 

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

Android studio opencv报错undefined reference to 'cv::imwrite(cv::String const&, c_第6张图片

 

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

Android studio opencv报错undefined reference to 'cv::imwrite(cv::String const&, c_第7张图片

5.重新build下,ok了

你可能感兴趣的:(android,opencv,c++,cmake,android,studio,android)