Learn C language on your Android phone-build your Android phone C + + build environment: Creating a world of programs

Source: Internet
Author: User
Tags root access ssh server

learn on your Android phone C language

Build of Android mobile phone- C + + compiler environment : creation of program World  

QQ running on the computer, QQ on the phone is the program, the power can use the magic, if I say they are programmers with an English alphabet, numbers, strange symbols created, I think those without any concept of friends may be surprised.

Yes, everything was magical before the mystery of the program World was unveiled.

In fact, the program does use an English letter (or phonetic Alphabet ...) To write it, and write it like a novel. But not after writing to save the written content to a file, and then change the file name can be used when the software. Programmers are writing programs that are not intended for people to look at on a computer, on a phone called CPU hardware. In short, the programmer writes the text is the command, is released to the CPU, lets the CPU do, the CPU does, for example lets the CPU on the screen displays what one picture, displays a button and so on. Unfortunately, the CPU is an electronic product, and does not recognize the English letters, numbers, and some of the scribblings and similar symbols.

CPU only recognizes 0 and 1, to give the CPU to publish commands to the CPU can recognize the language, in the CPU language, all the text only two 0 and 1. Is not very strange, do not want to break the head can not figure out the two number of the language is how to make a piece of earth-shattering events.

Keep up your quest and you can search beyond this article to complement this knowledge.

Now all you need to know is that the CPU uses the language called Machine language, which is very obscure. Early in the morning, the programmer's fairy was using this arcane spell to get the CPU to work.

In this case, the command to the CPU needs to be written down in our human language and then translated into a machine language that can be recognized by the CPU and then handed to the CPU for execution. This kind of work is very troublesome. Later on the programmer invented a magic weapon-translation software, this magic weapon can be the programmer can see enough to understand the CPU but not understand the text translated into the CPU to understand the machine language .

Because the human language is too verbose, too complex, on the fairy in the production of translation software This magic weapon when used or machine language production, and these are foreign to the fairy, so this translation software can only translate some specific English letters, numbers. If the other text, the other English letter input to the translation software, translation software even if killed can not translate. So the programmer on the fairy to the translation software can be translated text is called assembly language .

After the introduction of assembly language, a period of time, the program world has undergone tremendous changes. Later in the United States there are some intelligent, powerful power of the fairy, they are on the basis of assembly language has created some of the more severe language, these languages can recognize more words.

In the programming world, the fairies Divide machine language and assembly language into low-level languages, and later languages are divided into high-level languages.

The C language we have to learn is one of the high-level languages.

C language is a born in the United States on the elixir Niss Richie invented, the upper fairy high-strength is heinous, he is called the father of C language, the Father of Unix. Many of today's languages are influenced by the C language he invented.

Back to the point, we have to write the program, is in C language to complete.

The C program we write later will be translated into machine language by some translation software. (It is first translated into assembly language and then translated into machine languages).

And here, all we have to do is install the translation software.

C translation software is called GCC. This is an artifact that integrates C translation into a compilation, which compiles into machine language. This artifact of translating C into machine language is called a compiler.

In the program world, there are a lot of portals, Microsoft (Microsoft) is a portal, Unix and Linux is a portal. The compilers used in different portals are not the same, and Microsoft's compilers are no longer available on UNIX and Linux, It's like you're not going to be able to copy a running software on your computer to an Android phone.

The GCC that we use here is the Linux portal compiler software, originally this kind of software can only be used on the Linux Gate System (Linux System), on the Android is not used, and Android does not have the ability to run directly on the compiler, But there are some very powerful players who have transformed Linux into something that can run on Android, so we need to run the Linux system on Android, run the compiler on the Linux system, and give the compiler the program we wrote.

The following official entry topics:

The first step:

First of all, your phone needs to get root privileges. If you don't know how to get it, you can search for the Android root tutorial on your computer. Different brands of phone root methods are different. You can also go to the Jifeng forum to find the specific method of root.

Step Two:

Download a software: Complete Linux

Link Address:

http://heanet.dl.sourceforge.net/project/linuxonandroid/App/Complete%20Linux%20Installer%20v2-8.apk

Install it after the download is complete.

After the installation is complete, the first boot will appear after opening the software, then you need to install the boot script and BusyBox prompt, click OK to continue

If this does not appear, then prove that the software is not installed, you can in the settings – the application to find the software, and then clear the data, then re-open the software should be able to show this hint, if you still do not prompt, it may be your hand on the phone a bit of a problem.

Step Three:

After this soft armor is installed, you will also need to download a file, which is the Linux system (Ubuntu distribution Linux System), the following is the link:

Http://jaist.dl.sourceforge.net/project/linuxonandroid/Ubuntu/14.04/Core/ubuntu-14.04.CORE.ext4.PREALPHAv1.zip

If the link fails, look for it in http://linuxonandroid.org/downloads.

After the file has been downloaded, it needs to be decompressed because it is a compressed package file. Recommended here is an Android decompression software: Zarchiver, you can unzip the files in the package into any directory, but the directory finally do not have Chinese characters.

Fourth Step:

After unpacking, download a software: terminal emulator. This software is used to enter the Linux system.

Links: HTTP://PAN.BAIDU.COM/S/1KU7UCKF

Install it directly after the download is complete.

Fifth Step:

After installing the terminal emulator, go back to complete Linux software.

Click on the top left corner of the software, click Start System, will appear the interface shown,

Then click on the setting (set meaning) in the upper right corner, then click Edit.

Then the phone will appear another interface:

Click Save changes when you are finished.

Then click Start Linux

In general, there will be an interface that requires root access, if not, to prove that your phone does not have root access, then you need to go back to the first step to get root access, if any, to allow access.

If successful, the software will automatically start the Linux system.

When the system is first started, some configuration is required,

Enter n followed by carriage return.

When you enter the password, there will be no characters to display, so don't be nervous, your phone is not broken. Enter the password after entering it.

What if I touch start VNC server? (y/n) and Start SSH server? (y/n), you can enter n and then enter.

If you encounter save settings as default (y/n) (you can always change it later in the app), enter Y and then enter.

One final step:

When the last [email protected]:~# appears, it proves that you are successful. If you do not want to use the Linux system temporarily, you need to enter the Exit command and then enter. Otherwise you might not be able to enter the Linux system next time, until you reboot.

The first start of the Linux system, there is basically no software, we have to use the compiler has not been installed. So you also need to install the compiler. The installation compiler can be manipulated by commands (because there is no graphical interface, so it can only be manipulated by entering commands).

First, the system needs to be updated, otherwise the software cannot be installed:

Input command: sudo apt-get update

After the carriage return, some files are automatically downloaded and may take a long time. You are not allowed to enter the command again when the download is complete.

Once the download is complete, you can download and install the GCC compiler.

Input command: sudo apt-get install g++

After the carriage return, the system will automatically download the g++ compiler (you will understand him as an upgraded version of GCC), may be downloaded when the time to stop to ask if you really want to download the general prompt (y/n), enter Y and then return to the good.

After completion (after you can enter the command again), you need to type g++ and then enter

If bash:g++ is displayed: Command not found

Then you do not have the installation successful, you need to re-execute the command: sudo apt-get update, and then execute the sudo apt-get install g++

Maybe the previous two or three times will fail, try to try a few times just fine.

This chapter is here.

Learn C language on your Android phone-build your Android phone C + + build environment: Creating a world of programs

Related Article

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.