A preliminary study of c ++ programming in Linux-general Linux technology-Linux programming and kernel information. The following is a detailed description. C ++ programming in Linux is similar to programming in Windows. It also requires steps such as compilation, linking, scheduling, and running, however, they do not do the same thing in the two operating systems.
In Windows, there are TC, BC, VC and other compilers, which greatly facilitate program editing and compilation. In Windows, you only need to understand the menu. In Linux, there are tools such as Gcc, G ++, and Gdb. At the beginning, you may not even know how to debug the program, or even where to edit the program. But these are not problems. Let's take a look at them!
Next we will take the simplest and most classic Hello World! Let's start!
1. program editing
Editing a program can be performed in any text editor. At the beginning, I used gedit.
Open gedit and enter the following program:
// File HelloWorld. cpp
# Include
Int main ()
{
Cout <"Hello Linux World! "<Return 0;
}
Save or;
2. Open the terminal
You can right-click the terminal on the desktop, or open it elsewhere. Find the path saved by your program and enter the following command:
$ G ++-o HelloLinux. cpp
$./HelloLinux
Are the results displayed in the above program? All right, this ends the first C ++ program!
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