On the Android platformProgramIt runs on the Dalvik simulator in Java format, but android can execute the navtive C ++ program as a Linux kernel. The main steps are as follows:
1. Download arm C ++ crossover compiler http://www.codesourcery.com/gnu_toolchains/arm/portal/subscription3057
2. Write local C ++CodeFor example, hello wolrd, you can use the standard library STL. The compiled command line is as follows:
Arm-none-linux-gnueabi-g00000000.exe-static-oandroid123 android123.cpp
First run the arm-none-linux-gnueabi-g00000000.exe program. The-static parameter indicates the static library,-O indicates the output name android123, And the last android123.cpp isSource code.
3. Run the simulator. Run CMD in the sdktools directory named ADB pushandroid123/system/sbin/android123.
4. Set access permissions. in Linux Shell, set full control permissions for all users under cmd. ADB shell chmod 777/system/sbin/android123
5. Run the android123 program and enterADB shell CD/system/sbin/android123
You can.