致命错误:使用 OpenCV 2.4.11 找不到"ext/atomicity.h"文件
Fatal error: 'ext/atomicity.h' file not found using OpenCV 2.4.11
我发现问题可能出在标准库上......但是我不知道如何使用Cmake更改它。 我尝试了很多选择,但没有工作。
Mybuild.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "27.0.3"
defaultConfig {
applicationId "com.test"
minSdkVersion 21
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
externalNativeBuild {
cmake {
cppFlags "-frtti -fexceptions"
abiFilters "armeabi-v7a"
}
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
externalNativeBuild {
cmake {
path "src/main/cpp/CMakeLists.txt"
}
}
sourceSets { main { jni.srcDirs = ['src/main/cpp', 'src/main/jniLib/'] } }
}
dependencies {
implementation project(':openCVLibrary2411')
}
我的CMAkeList.txt看起来像这样:
cmake_minimum_required(VERSION 3.4.1)
#set(ANDROID_STL "c++_shared")
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# OpenCV IMPORT
include_directories(C:/OpenCV-android-sdk_2_4_11/sdk/native/jni/include)
add_library( lib-opencv SHARED IMPORTED )
set_target_properties(lib-opencv PROPERTIES IMPORTED_LOCATION ${CMAKE_SOURCE_DIR}/../jniLibs/${ANDROID_ABI}/libopencv_java.so)
add_library( # Sets the name of the library.
native-lib
# Sets the library as a shared library.
SHARED
# Provides a relative path to your source file(s).
native-lib.cpp
main.cpp
)
find_library( # Sets the name of the path variable.
log-lib
# Specifies the name of the NDK library that
# you want CMake to locate.
log )
target_link_libraries( # Specifies the target library.
native-lib
# Links the target library to the log library
# included in the NDK.
${log-lib} )
我检查了这个链接,但用于 ndk 构建...但我正在使用cmake(Android Studio 3+(
你对的问题是因为 stl [libc++]
https://stackoverflow.com/a/13037661/5052296
要更改build.gradle中的 STL,请执行以下操作:
externalNativeBuild {
cmake {
arguments '-DANDROID_STL=gnustl_shared'
}
}
https://developer.android.com/ndk/guides/cmake
另一种选择:
编辑"include/opencv2/core/operations.hpp"文件。
相关文章:
- SampleConsensusPrerejective(ext.RANSAC)是如何真正工作的
- 致命错误:使用 OpenCV 2.4.11 找不到"ext/atomicity.h"文件
- 将 std::atomic_flag 包裹在吸气剂/二传手中会使它的"atomicity"无效吗?
- 如何在C / CPP中使用ext更改文件名
- 在OS X 10.9上找不到'ext/slist'文件
- 致命错误:在Mac上找不到'ext/hash_map.h'文件
- 我在哪里可以找到atomicity.h中的函数定义
- 将关键函数放在析构函数中以"enhance atomicity" ?
- 为什么str2double在matlab中比ext函数慢?
- GCC ext头-最新的文档
- 重写由另一个ext定义的方法
- 释放MFC Ext DLL时的断言错误@ dllmodule . cpp# 230
- C++ GCC/MinGW 路径:ssp、ext、tr1;并行,扩展,位,实验