How to compile C Programs in linux-general Linux technology-Linux programming and kernel information. The following is a detailed description. First, set it on the VMware Workstation interface.
There are two labels on the VMware Workstation interface, one is "Home" and the other is "Ubuntu" (because I gave it the name "Ubuntu" when I installed the virtual machine "), click "Ubuntu" and there is a "Commands" box in the middle of the interface. The following line is: Edit virtual machine settings. Click it and a dialog box is displayed. There are two tabs: "Hardware" and "Options". Under the "Hardware" tab, there are several items about your VM settings, there is a "CD/DVD (IDE)", click it, you can set it on the right side, there are two single choice under the Connection, one is "Use Physical drive ", the first one is "Use ISO image file". Select the next one and click "Browse" on the right of the blank box ", select your linux operating system image file (the Iso file when you installed the system) and click "OK" below to confirm. This is half done.
Enter the linux operating system on the VM.
Enter the terminal, execute the command sudo apt-get install build-essential (this step should install GCC), and then write a test in any directory. c program (you can use gedit test. c or vi test. if you write the c command, a text file will appear. You can write a simple program and save it. If you use vi to write data, you still need to know its usage. It is easier to use gedit ). Enter gcc-o test. c in the terminal. (The-o option specifies a file name, And the executable file after gcc compilation is test. If gcc test. c is used directly, the compiled executable file is a. out. Then enter the command. /test or. /. out (if you do not use-o to specify the file name), you will see the output result of the 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