我的电脑里安装了arm-linux-androideabi-gcc,但是当我试图编译一个简单的hellow世界时,它会产生错误(我选择不使用ndk-build )。我只想从命令行编译..。
#include <iostream>
using namespace std;
int main (){
return 0;
}我收到了这个错误:
错误: iostream:没有这样的文件或目录
我有~/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++发布于 2012-07-31 19:56:49
首先,需要创建独立的工具链:
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注意:使用修订8b发布,这是NDK: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发布于 2012-07-31 19:43:26
看看错误:iostream: No such file or directory
#include "iostream"应该是#包括#include <iostream>
发布于 2012-11-08 07:47:51
根据http://code.google.com/p/android/issues/detail?id=35279的说法,这是独立工具链的一个bug。我认为最好的解决办法是ln -s $TOOLCH/arm-linux-androideabi/include/c++/4.6 $TOOLCH/arm-linux-androideabi/include/c++/4.6.x-google
https://stackoverflow.com/questions/11747734
复制相似问题