Use iPad to write c ++ programs

Source: Internet
Author: User

Use iPad to write c ++ program 1. Build a C ++ Environment
1. Install the Deb package in cydia
Note: change to developer in cydia-software source-settings; otherwise, some Deb cannot be searched.

OpenSSH and OpenSSL
Wget (download tool)
Aptitude and APT 0.6 transitional (DEB package tool)
Unzip and zip (decompression and compression packaging tools)2. Use Putty to connect to the iPad (the following steps can be performed directly on the iPad without using a computer, but the building process must have a network. See the following article)Assume that the IP address of your iPad is 192.168.1.104.

Putty download: http://putty.very.rulez.org/latest/x86/putty.exe
Connect with WiFi
Connection Type: Select SSH (default)
Port 22 (default)
Press open (default)


Putty connected to 192.168.1.104
Use login as the root user
Password (assuming you have not changed the password)
Note: No matter whether it is putty or the iPad command line mentioned in the end of this article, no characters are displayed when you enter the password. after entering the password, press Enter.
Note: whether it's putty or the iPad command line mentioned in the end of this article, the default path after logging on to the root account is/var/root/
3 install the iPhone GCC and signature Tool

In putty (right-click putty and paste it ):

  1. Wget http://apt.saurik.com/debs/libgcc_4.2-20080410-1-6_iphoneos-arm.deb
  2. Dpkg-I libgcc_4.2-20080410-1-6_iphoneos-arm.deb
  3. Apt-Get install iPhone-GCC ldid make

Two possible errors in the last sentence:
1. If you cannot find the apt command, search for apt in cydia and install apt 0.6 transitional, APT 0.7 (APT-Key), APT 0.7 HTTPS method, APT 0.7 strict, apt0.7 strict (LIB), aptitude
Note: Although I don't know what the role is, it's okay, and it will be installed for later programming.
2. Reference http://blog.163.com/cobyeah@126/blog/static/140137653201142354756503/
When you use apt-get to install or update the software, the following message is displayed:

  1. E: cocould not get lock/var/lib/dpkg/lock-open (11 Resource temporarily unavailable)
  2. E: Unable to lock the Administration Directory (/var/lib/dpkg/), is another process using it?

Delete the/var/lib/dpkg/lock file.
4. Download sys32libheader. tgz
115 download: http://115.com/file/bhy27ghj
Copy to/var/root
5. Install the 3.2 SDK (IPAD) header file
In putty (right-click putty and paste it ):

  1. Mkdir-P/var/toolchain
  2. CD/var/toolchain
  3. Tar xzvf/var/root/sys32libheader. tgz
  4. CP-P/var/toolchain/sys32/usr/lib/libstdc ++. */usr/lib/
  5. CD/usr/lib/
  6. Ln-s libsystem. B. dylib libsystem. dylib

At this point, the C ++ programming environment has been set up. Next we will use a small program to explain how to program 2. how to program
Compile helloworld. cpp on your computer in Notepad

  1. # Include
  2. Using namespace STD;
  3. Int main ()
  4. {
  5. Cout <"Hello world !" <Endl;
  6. Return 0;
  7. }

Copy helloworld. cpp to/var/root /,
In putty (right-click putty and paste it ):

  1. Arm-apple-darwin9-g ++-I "/var/toolchain/sys32/usr/include"-I "/var/toolchain/sys32/usr/include/C ++/4.2.1"-I" /var/toolchain/sys32/usr/include/C ++/4.2.1/armv7-apple-darwin9 "-l"/var/toolchain/sys32/usr/lib "helloworld. CPP-O helloworld
  2. Ldid-s helloworld
  3. ./Helloworld


In this case, you can see

This is the compiled program and can be run with./helloworld (./indicates the current path)

Summary:
Compile:

  1. Arm-apple-darwin9-g ++-I "/var/toolchain/sys32/usr/include"-I "/var/toolchain/sys32/usr/include/C ++/4.2.1"-I" /var/toolchain/sys32/usr/include/C ++/4.2.1/armv7-apple-darwin9 "-l"/var/toolchain/sys32/usr/lib "program name. CPP-O program name
  2. Ldid-s program name

Run:

  1. ./Program name

Iii. Code compiling software
From the above example, we can see that what iPad can do now is to have a C ++ environment and compile it. Other programs are required to write code.
VI improved is recommended for the original post. You can search for and install it in cydia by entering Vim in putty or command line, and the exit mode is to input uppercase Z twice consecutively and quickly, detailed operation can refer to the http://www.caole.net/diary/vim.html
I can find a lot of iPad Code compiling software on the Internet. I use textastic (see the final figure for the image and download)

4. iPad command line
All of the above is about using Putty to control iPad compilation and execute programs on the computer. However, if your computer is always there, you don't need to use iPad programming. Next, let's talk about how to implement the above process on the iPad.
Search for and install mobileterminal in cydia
Open terminal and click I in the lower-right corner to go to program settings and manage quick input and gesture operations.
All subsequent steps are the same as using putty on your computer.
Note: a network connection is required when an environment is set up, such as the installation of the iPhone GCC and signature tool.
Wget

Http://apt.saurik.com/debs/libgcc_4.2-20080410-1-6_iphoneos-arm.deb# 下

On the iPad, run the command line to enter the root account:
Enter Login
Use login as the root user
Password (assuming you have not changed the password)

For more information about how to use the command line, refer:
Http://blog.sina.com.cn/s/blog_51d3553f0100xrxz.html

Code compiling software: textastic
It is very convenient to write code. The interface is as follows:

The assistivetouch in the middle is enabled to protect the Home key during screen capture. It has nothing to do with the program.
I didn't install ikeywi HD, because I felt comfortable typing with big buttons, and the software had character input (the four-Angle Slide characters on the top of the keyboard)
To facilitate program compilation, you can create quick Input
In ifile (a file management software should know), find the path of. cpp, press bookmarks, and press "+"



Copy/var... Path after,
In terminal, press I in the lower right corner to open the menu, choose shortcut menu-New, input "cd" in the cut action, and paste it. Then, you can enter it quickly in the lower left corner of terminal.

Textastic download: Textastic-v4.0.2.ipa (5206 K) Downloads: 14

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

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.