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: