2

test.c

#include <stdio.h>

int main(void) 
{

    printf("Hello world!\n");


    return 0;

}

then,

prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.6/bin/arm-linux-androideabi-gcc test.c -o hello

test.c:1:19: fatal error: stdio.h: No such file or directory

how to use this gcc in android project?

add systoot?

I try

prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.6/bin/arm-linux-androideabi-gcc --sysroot=bionic/libc/arch-arm test.c -o hello

but get the same result:

test.c:1:19: fatal error: stdio.h: No such file or directory

please help !

Some programmer dude
  • 400,186
  • 35
  • 402
  • 621
Starsky
  • 21
  • 1
  • 3
  • #include int main(void) { printf("Hello world!\n"); return 0; } – Starsky Jun 22 '16 at 03:36
  • possible duplicate of http://stackoverflow.com/questions/14307611/problems-compiling-object-using-arm-linux-androideabi-gcc – µtex Jun 22 '16 at 04:26

1 Answers1

0

You need to install pre-requested package using below command,

sudo apt-get install gcc-arm-linux-androideabi

then run the

arm-linux-androideabi-gcc --sysroot=/opt/android/android-ndk-r9c/platforms/android-19/arch-arm -o test lin.c
msc
  • 33,420
  • 29
  • 119
  • 214
  • I work on putty, make whole android project is OK, in BoardConfig.mk, CROSS_COMPILE := prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin/arm-eabi-. – Starsky Jun 22 '16 at 05:41
  • If I just run gcc text.c -o hello, there is no problem – Starsky Jun 22 '16 at 05:52
  • It doesn't seem to be a `gcc-arm-linux-androideabi` package any more. It seems like it was a one-off for 16.04 LTS Xenial? I need it though now. – Csaba Toth Mar 30 '20 at 06:16