Categories
android android-ndk g++ shell

How to run C++ application in Android SHELL

I want to run hello world written on C++ and compiled with Android toolchain 9, but I faced with issue: by default I have no permissions to launch it and I can’t change permissions using chmod`.

I used Android 2.3.3 - Api Level 10

Application was compiled by cross compiler for API level 9

Procedure:

Compile application:

~/toolchain_andr9/bin/ arm-linux-androideabi-g++ helloworld.cpp

Then send application to SDCARD on the emulator:

>adb push a.out /mnt/sdcard

then go to SHELL and try to run a.out:

>adb shell
>
>/mnt/sdcard/a.out

And result is:

>`/mnt/sdcard/a.out: permission denied`

command ls -l shows rights for a.out:

>`----rwxr-x system   sdcard_rw   863656 2012-04-12 22:42 a.out`

I tried to change permissions:

>chmod 777 /mnt/sdcard/a.out

But rights don’t change:

>`----rwxr-x system   sdcard_rw   863656 2012-04-12 22:42 a.out`

I think I have left some important thing using android.

Could anybody help me and give me a way how to run application in `Android SHELL?

Thanks a lot.

P.S. sorry for my English =)