问题描述
我已经针对Android armeabi-v7a编译了OpenCV静态库.
I've compiled OpenCV static libraries targeting android armeabi-v7a.
现在,我正尝试通过Android Studio中的CMakeLists.txt文件将本机C ++代码与这些库链接,但这会失败,并出现以下奇怪错误:
Now I'm trying to link my native C++ code with those libraries through a CMakeLists.txt file in Android Studio but this fails with this weird error :
~/opencv/modules/videoio/src/container_avi.cpp:0: error: undefined reference to 'stderr'
此代码来自libopencv_videoio.a
This code comes from the libopencv_videoio.a
CMakeLists.txt文件最有趣的部分是这个
The interresting part of the CMakeLists.txt file is this
# linking with static libraries
target_link_libraries(native-lib
dnn ml objdetect shape stitching superres videostab calib3d features2d highgui videoio imgcodecs video photo imgproc flann core
)
不是应该自动查找标准库吗?
Isn't it supposed to find standard libraries automatically ?
以下是我的Application.mk
EDIT 1:Following is my Application.mk
...
NDK_TOOLCHAIN_VERSION := clang
APP_PLATFORM := android-21
APP_STL := c++_shared
...
NDK版本取自Changelog.md:r17b
NDK version taken from Changelog.md : r17b
如丹所建议,我已添加
cmake参数
推荐答案
最可能的情况是您为android-23 +构建了opencv,但native-lib在其下有一个minSdkVersion.请参见 https://android.googlesource.com/platform/ndk/+/master/docs/user/common_problems.md#using-mismatched-prebuilt-libraries .
The most likely scenario is that you built opencv for android-23+ but native-lib has a minSdkVersion below that. See https://android.googlesource.com/platform/ndk/+/master/docs/user/common_problems.md#using-mismatched-prebuilt-libraries.
这篇关于带有NDK的Android Studio:链接错误:对"stderr"的未定义引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!