Why arm-linux-androideabi-gcc gives iostream error

I have arm-linux-androideabi-gcc installed on my computer, but when I try to execute the compiler even in the simple world of hellow, it gives an error (I prefer not to use ndk-build). I just want to compile from the command line ...

#include <iostream> using namespace std; int main (){ return 0; } 

And I got this error:

error: iostream: no such file or directory

I have arm-linux-androideabi-gcc in ~/android-ndk-r8b/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin .

I tried to enable -I ~/android-ndk-r7b/platforms/android-9/arch-arm/usr

I also tried including -lstdc++ to see if it works, but no ...

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

First you need to create a standalone toolchain:

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

export PATH:

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

Then create a file:

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

Note: The problem with using revision 8b, which is the latest version of the 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 
+7
source

Look at the error: iostream: No such file or directory

#include "iostream" should be #include #include <iostream>

+1
source

According to http://code.google.com/p/android/issues/detail?id=35279 , this is an offline toolchain error. I think the best fix is ln -s $TOOLCH/arm-linux-androideabi/include/c++/4.6 $TOOLCH/arm-linux-androideabi/include/c++/4.6.x-google

0
source

Source: https://habr.com/ru/post/921797/


All Articles