gpt4 book ai didi

android - 为什么 arm-linux-androideabi-gcc 给出 iostream 错误

转载 作者:塔克拉玛干 更新时间:2023-11-02 22:22:21 24 4
gpt4 key购买 nike

我的电脑上安装了 arm-linux-androideabi-gcc,但是当我尝试编译一个简单的 hellow world 时,它给出了错误(我选择不使用 ndk-build)。我只想从命令行编译...

#include <iostream>

using namespace std;

int main (){
return 0;
}

我收到了这个错误:

error: iostream: No such file or directory

我在 ~/android-ndk-r8b/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin 中有 arm-linux-androideabi-gcc。

我试过包括 -I ~/android-ndk-r7b/platforms/android-9/arch-arm/usr

我也试过包括 -lstdc++ 只是为了看看它是否有效但没有......

./arm-linux-androideabi-g++ -o ff first.cpp -I /home/hari/android-ndk-r7b/platforms/android-9/arch-arm/usr -lstdc++

最佳答案

首先您需要创建独立的工具链:

make-standalone-toolchain.sh --platform=android-14 --install-dir=standalone-toolchain --ndk-dir=$ANDROID_NDK_PATH

导出路径:

export PATH=$TOOLCH/standalone-toolchain/bin:$PATH

然后构建文件:

arm-linux-androideabi-g++ -o test-new test.cpp

注意:使用最新版本的 NDK 版本 8b 的问题:http://code.google.com/p/android/issues/detail?id=35279

arm-linux-androideabi-g++ -o test-new test.cpp --sysroot=$TOOLCH/sysroot
-I$TOOLCH/lib/gcc/arm-linux-androideabi/4.6.x-google/include
-I$TOOLCH/lib/gcc/arm-linux-androideabi/4.6.x-google/include-fixed
-I$TOOLCH/arm-linux-androideabi/include/c++/4.6
-I$TOOLCH/arm-linux-androideabi/include/c++/4.6/arm-linux-androideabi
-I$TOOLCH/sysroot/usr/include

关于android - 为什么 arm-linux-androideabi-gcc 给出 iostream 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11747734/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com