Android compiling Local C ++ Program Method

Source: Internet
Author: User
Tags java format

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/android123You can.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.