One of the notes for learning linux based on cygwin: getting started, cygwinlinux

Source: Internet
Author: User

One of the notes for learning linux based on cygwin: getting started, cygwinlinux

Recently I started to learn about linux. I didn't want to install dual-system or virtual machines, so I ran a cygwin command to simulate the linux environment in windows.

First install some common plug-in packages: make, gcc, g ++, awk, sed, vim, and so on.

First, fix the problem that the vim direction keys and backward keys under cygwin cannot be used:

Go to the vim74 folder (depending on vim73, 74, or a later version ):

$ cd /usr/share/vim/vim74

Set vim:

$ cp vimrc_example.vim  ~/.vimrc

After the change, the keywords of the programming language in vim are also added with color, which is great.

Use vim to create a cpp File

First, create a file:

$ vim HelloWorld.cpp</span>
After entering vim, enter I to enter the editing mode. The relevant code is as follows:

#include <iostream>int main(){      std::cout<<"HelloWorld!\n";      return 0;}
Press esc to exit the editing mode.

Enter ":" to accept the command

Save and release vim

wq
Compile the CPP file. (The output file name of the prepared file is a.exe. Here I use-o myCpp to rename the output file to myCpp)

$ g++ -o myCpp HelloWorld.cpp
Run the compiled file

$ ./myCpp.exe
Printed successfully:
HelloWorld!

For reference:





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.