Android Studio编译JNI项目,Cmake出错:Detecting C compiler ABI info - failed

cmake的定义是什么 ?-----⾼级编译配置⼯具cmake就是将多个cpp、hpp文件组合构建为一个大工程的语言。他能够输出各种各样的makefile或者project文件,所有操作都是通过编译CMakeLists.txt来完成。

在使用Android Stodio编译JNI项目时出现Cmake错误,报错如下:

Execution failed for task ':app:configureCMakeDebug[arm64-v8a]'.
> [CXX1429] error when building with cmake using C:\Users\Dell\AndroidStudioProjects\MyApplication2\app\src\main\cpp\CMakeLists.txt: -- Android: Targeting API '31' with architecture 'arm64', ABI 'arm64-v8a', and processor 'aarch64'
  -- Android: Selected unified Clang toolchain
  -- The C compiler identification is unknown
  -- The CXX compiler identification is Clang 12.0.8
  -- Detecting C compiler ABI info
  -- Detecting C compiler ABI info - failed
  -- Check for working C compiler: D:/Sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe
  -- Check for working C compiler: D:/Sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe - broken
  -- Configuring incomplete, errors occurred!

在这里插入图片描述

在cpp\CMakeLists.txt文件最上方添加后解决问题

会在编译时跳过编译器检查,就不会再出现异常了。

set(CMAKE_C_COMPILER_WORKS TRUE)
set(CMAKE_CXX_COMPILER_WORKS TRUE)
弱小不是逃避的借口,应是竭尽全力的理由。
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值