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 ):
- Wget http://apt.saurik.com/debs/libgcc_4.2-20080410-1-6_iphoneos-arm.deb
- Dpkg-I libgcc_4.2-20080410-1-6_iphoneos-arm.deb
- 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:
- E: cocould not get lock/var/lib/dpkg/lock-open (11 Resource temporarily unavailable)
- 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 ):
- Mkdir-P/var/toolchain
- CD/var/toolchain
- Tar xzvf/var/root/sys32libheader. tgz
- CP-P/var/toolchain/sys32/usr/lib/libstdc ++. */usr/lib/
- CD/usr/lib/
- 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
- # Include
- Using namespace STD;
- Int main ()
- {
- Cout <"Hello world !" <Endl;
- Return 0;
- }
Copy helloworld. cpp to/var/root /,
In putty (right-click putty and paste it ):
- 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
- Ldid-s helloworld
- ./Helloworld
In this case, you can see
This is the compiled program and can be run with./helloworld (./indicates the current path)
Summary:
Compile:
- 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
- Ldid-s program name
Run:
- ./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