C语言 android NDK 致命错误:stdio.h:没有这样的文件或目录 #include < stdio.



我正在尝试在我的 Archlinux 中为我的 Qt android 项目构建 QPSQL 驱动程序,该项目不断失败

configure: error: C preprocessor "/opt/AndroidSDK/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-cpp" fails sanity check

所以我尝试了简单的问候世界计划:-

% /opt/AndroidSDK/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-cpp t.c
# 1 "t.c"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "t.c"
t.c:1:19: fatal error: stdio.h: No such file or directory
#include <stdio.h>
^
compilation terminated.

这意味着arm-linux-androideabi-cpp预处理器不工作,对吧? 但是我来自Qt Creator和Android Studio的其他项目构建并运行良好

我该怎么办?我尝试将 NDK 更新到 18,结果很糟糕,因为他们用 clang 替换了 gcc。所以我有 r17b 和最新的安卓 SDK.

如果不传递一大堆标志将它们指向 sysroot,就无法调用$NDK/toolchains中的工具(启用这种用例是 r19 的功能(。

使用 https://developer.android.com/ndk/guides/standalone_toolchain 为此类用途配置工具链。

最新更新