Android Project that I am facing error has OpenCV & custom implementation of some cpp classes for image processing. I have include opencv-3-3-0-android-sdk
in CMakeLists.txt
which is used for building native components.
include_directories( ../opencv-3-3-0-android-sdk/sdk/native/jni/include/)
add_library( lib_opencv
SHARED
IMPORTED )
set_target_properties( lib_opencv
PROPERTIES IMPORTED_LOCATION
${PROJECT_SOURCE_DIR}/../opencv-3-3-0-android-sdk/sdk/native/libs/${ANDROID_ABI}/libopencv_java3.so )
While invoking following method it throws error:
void saveMat(const cv::Mat& mat, std::string dst){
cv::imwrite(dst, mat);//throws error - undefined reference
}
Getting following error while running the project which states that cannot reference to imwrite. Though
error: undefined reference to 'cv::imwrite(cv::String const&, cv::_InputArray const&, std::__ndk1::vector<int, std::__ndk1::allocator<int> > const&)'.
Though on navigation to that function using ctrl does take me to proper function which is inside opencv2/imgcodecs.hpp
.
CV_EXPORTS_W bool imwrite( const String& filename, InputArray img,
const std::vector<int>& params = std::vector<int>());
To me it seems like linkage error. Is there any idea why while running the application it throws above mentioned error?