Программы на C++. Форум разработчиков
-
Anonymous
Android NDK Cmake Ошибка: пытался включить , но не нашел Libc ++ 's Заголовок
Сообщение
Anonymous »
Я переживаю эту ошибку с различными нативными библиотеками: stdlib , stdint , string и т. Д. />[*]build.gradle.kts:
< /ul>
Код: Выделить всё
android {
ndkVersion = "28.2.13676358"
defaultConfig {
externalNativeBuild {
cmake {
arguments += "-DANDROID_STL=c++_shared"
cppFlags += "-std=c++17 -fexceptions -frtti"
}
}
ndk {
abiFilters.remove("riscv64")
stl = "c++_shared"
}
}
}
...
< /code>
[*]cmakelists.txt:
< /ul>
cmake_minimum_required(VERSION 4.1.1)
project(native-lib CXX)
find_package(openssl REQUIRED CONFIG)
find_package(curl REQUIRED CONFIG)
...
add_library(native-lib SHARED src/main/cpp/native-lib.cpp)
set_target_properties(native-lib PROPERTIES CXX_STANDARD 17)
target_link_libraries(native-lib
PRIVATE
...
)
< /code>
[*] android.mk:
< /ul>
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := libapp
LOCAL_SRC_FILES := native-lib.cpp
LOCAL_SHARED_LIBRARIES := curl
include $(BUILD_SHARED_LIBRARY)
ifneq ($(call ndk-major-at-least,21),true)
$(call import-add-path,$(NDK_GRADLE_INJECTED_IMPORT_PATH))
endif
$(call import-module,prefab/curl)
< /code>
[*] application.mk:
< /ul>
APP_STL := c++_shared
APP_CPPFLAGS := -std=c++17
APP_CFLAGS := -Wall -Werror
< /code>
[*]native-lib.cpp
< /ul>
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include "curl/curl.h"
#include "java_interop.h"
#include "cpp-subprocess/subprocess.hpp"
#include "Arduino.h"
...
Редактировать: попросил некоторую помощь от Arduino Polks
Подробнее здесь:
https://stackoverflow.com/questions/797 ... nt-find-li
1758806646
Anonymous
Я переживаю эту ошибку с различными нативными библиотеками: stdlib , stdint , string и т. Д. />[*]build.gradle.kts:
< /ul>
[code]android {
ndkVersion = "28.2.13676358"
defaultConfig {
externalNativeBuild {
cmake {
arguments += "-DANDROID_STL=c++_shared"
cppFlags += "-std=c++17 -fexceptions -frtti"
}
}
ndk {
abiFilters.remove("riscv64")
stl = "c++_shared"
}
}
}
...
< /code>
[*]cmakelists.txt:
< /ul>
cmake_minimum_required(VERSION 4.1.1)
project(native-lib CXX)
find_package(openssl REQUIRED CONFIG)
find_package(curl REQUIRED CONFIG)
...
add_library(native-lib SHARED src/main/cpp/native-lib.cpp)
set_target_properties(native-lib PROPERTIES CXX_STANDARD 17)
target_link_libraries(native-lib
PRIVATE
...
)
< /code>
[*] android.mk:
< /ul>
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := libapp
LOCAL_SRC_FILES := native-lib.cpp
LOCAL_SHARED_LIBRARIES := curl
include $(BUILD_SHARED_LIBRARY)
ifneq ($(call ndk-major-at-least,21),true)
$(call import-add-path,$(NDK_GRADLE_INJECTED_IMPORT_PATH))
endif
$(call import-module,prefab/curl)
< /code>
[*] application.mk:
< /ul>
APP_STL := c++_shared
APP_CPPFLAGS := -std=c++17
APP_CFLAGS := -Wall -Werror
< /code>
[*]native-lib.cpp
< /ul>
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include "curl/curl.h"
#include "java_interop.h"
#include "cpp-subprocess/subprocess.hpp"
#include "Arduino.h"
...
[/code]
Редактировать: попросил некоторую помощь от Arduino Polks
Подробнее здесь: [url]https://stackoverflow.com/questions/79774697/android-ndk-cmake-error-cstdlib-tried-including-stdlib-h-but-didnt-find-li[/url]