Cygwin - Linux emulator on Windows
You still need to stick with Windows but Linux users to increase productivity, or simply to become familiar with the open source operating system this promise? There are solutions, but in many ways they used Cywin Windows emulator for Linux is the best solution, especially for the needs of convert file between two operating systems.
Cygwin is an environment that emulates the Linux operating system running on Windows, which helps Windows users can work just like on Linux without having to install the operating system on your computer. With Cygwin, you can edit and compile the code in C ++ on Linux operating system, compile and install the package on the Linux operating system, familiar with the Linux operating system by doing the command body this version of the operating system while continuing to work with Windows ...
1. Installing Cygwin
To install Cygwin, you first visit the site https://www.cygwin.com, click Install Cygwin line now (with Cygwin icon above) in the upper right corner of the page, or click on the line install or update now (with Cygwin icon above) in the middle of the site, or click on the words install Cygwin now (with Cygwin icon above) in the lower right corner of the website, to download the installation file (setup.exe file format), with a capacity of 572 KB. After downloading the computer (located in the folder C: Testing Cygwin), double click on the file to start the installation.
Appearing first installation window Cygwin Net Release Setup Program, click Next through the Choose A Download Source window. From this window, see 3 options:
- Install from Internet (downloaded files kept for future s? re-use): install from the Internet, download files will be used for the next time.
- Download Without Installing: just download the files without installing.
- Install from Local Directory: install from the folder on the computer.
Here we select Install from the Internet, your computer requires this time to have an Internet connection. Click Next through the Select Root Install Directory. From this window, in the box that appears Root Directory default is C: cygwin, we should leave this box (can adjust Cygwin installation directory by clicking the Browse button next to), on the lower side Install in the left pane for 2 options: All Users and Just Me. Select All Users, in the right frame right Default Text File Type select UNIX / binary. Click Next through the Select Local Package Directory. From this window, in the Local Package Directory box appears as the default is C: Testing Cygwin (folder containing installation file setup.exe).
I leave this box, click Next through the Select Your Internet Connection. From this window, select Direct Connection (if you are using the Internet via a proxy server, then select Use HTTP / FTP Proxy and enter the parameters in the cell immediately below the cell Proxy Host and Port). Progress through the window click Next, install the downloaded program list of sites catering to install Cygwin from https://cygwin.com address and automatically scrolls through the Choose A Download Site window. From this window, select any one site (for example, select https://cygwin.mirrors.hoobly.com) from the list of Available Download Sites frame, click Next through the window Progress.
The installation program download the list of packages installed Cygwin existence of just selected from the above site and then automatically transferred to the Select Packages. From this window, can leave the default settings according to recommendations of the program, but here should choose to add the packages to cater to solving the problem you need to do in Linux. For example we will install additional packages xemacs (the interface is quite similar Notepad) to help draft code C ++, by seeking to Category Editors, click the plus sign to the left to roll out of the package inside, find the package xemacs: A powerful, highly customizable open source text editor and application development system. Click digit New column Skip right to the left to activate the installation of this package, then Skip exchanged letters and columns 21.4.21-1 Bin? right with checkmarks X.
Also from this window, we select gcc-g ++ package: C ++ compiler (compiler for code written in C ++ on Linux) in the Category Devel. The installation program will automatically select the relevant package gcc -g ++ on.Also here, you can choose all of the Category Devel packages, choosing the same as selecting package xemacs package. After selecting all, click Next through the window Progress. From this window, run the installation program until the complete Cygwin. When completed will appear Create Icons window. I leave all the options Create icon on Desktop (create an icon on your desktop) and add to the Start Menu icon (add icons on the Start menu) and click Finish to complete the install Cygwin.
2. Get familiar with Cygwin with some basic commands of Linux
After installation is complete, to run Cygwin, click the Cygwin icon on your desktop (or the Start menu, select Programs, select Cygwin, Cygwin Bash Shell selected). Cygwin window appears (the same Windows DOS window) with the command prompt Administrator @ webserver ~ (the Administrator account name, have directory is C: cygwin home Administrator, and the webserver is the name of the computer) . From this command prompt, to turn over working C drive, type cd C: and press Enter. From drive C, to create folders (for example, create folders LBVMVT), type the command mkdir LBVMVT. To view this directory has been created yet, and content that contains what the C drive, type the command ls or ls-la. From this window, you can practice many other orders of Linux to become familiar with Cygwin. After finishing practice, typing logout or exit to close the program window Cygwin.
3. Prepare and compile a program written in C ++ on Linux
As we know, on Windows, to edit code and compile programs written in C ++, can use Borland C ++ Builder, Turbo C ++ ... Also on the Linux operating system, we can draft code by xemacs and compiled with g ++ compiler (2 packages have been installed above). From the command prompt on drive C side, we moved into the directory by typing cd LBVMVT LBVMVT, and from here we command xinchaolbvmvt.cpp xemacs xemacs editor to open the file editor xinchaolbvmvt.cpp. In the editor window, in C ++ code editor, eg drafting program is made simple sentence "Hello, welcome to LBVMVT!" To the screen when executed.
The code consists of 6 lines as follows:
#include <iostream>
using namespace std;
int main (void) {
cout << "Hello and welcome to LBVMVT!" << endl;
return 0;
}
After editing is complete, press the Save button (3rd button from the left) on the toolbar to save the code entered. On the File menu, choose Exit XEmacs to close this window. Return Cygwin window, type the command g ++ compiler -o xinchaolbvmvt xinchaolbvmvt.cpp to this file. After the translation is complete, execute the command ls, we see in the folder LBVMVT xinchaolbvmvt.exe additional executable files. To check the results, at the command prompt LBVMVT folder in the C drive, type or ./xinchaolbvmvt.exe ./xinchaolbvmvt.If the program output as the above salutation is the drafting and compiling a program written in C ++ on the Linux operating system has been successful. After you are done, type exit to logout or close the window Cygwin.
4. Compile and install software packages on Linux
With the software package for Linux that have not been packaged into .rpm format (.rpm files are installed using the command rpm -ivh), which provides compression formats such as .tar.gz, .tgz, tar.bz2 etc ..., the compilation and installation is done as on Linux. First download the compressed file in, then copy the zip file into the folder C: cygwin home Administrator, and then open the Cygwin, execute the command tar -zxvf (to extract the .tar file format gz, tgz) or bunzip2 and tar xvf (to unzip .tar.bz2 format files), then use the cd command to navigate to the unzipped folder. Once in the folder, go to the ./configure command (configure the package), make (compile the package), and make install (install the package).