In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces how the Linux system runs the C language program, the content is very detailed, interested friends can refer to, hope to be helpful to you.
How to run C language program in Linux system?
Open the installed Linux system (ubuntu18.04)
1. The installation editor uses the statement: sudo apt-get install vim installs vim, and you can check to see if the vim editor is installed before installation. (special note: it is best to update the software before installing vim, use the instruction sudo apt-get update.) the reason for adding sudo is that they need to use administrator privileges to install and update the software. two。 Installing the gcc compiler is similar to installing vim using sudo apt-get install gcc. After installation, you can use cc-v to view compiler version information, and so on. The cc-v interface is as follows:
(gcc is often abbreviated as cc) of course, it is best to use the command to update the software before installing all the software.
3. Create a folder and enter the file
You can use the directive ls to see what files are on the system before creating a folder. Then create a file with the mkdir+ file name and see if the file has been created. (if you create a file named workspace mkdir workspace) enter the file and use the command cd workspace. Then enter the directory. Then create a file named les1 (mkdir les1). Enter the les1 file (cd les1). Create a .c file: touch a.c.
4. Edit the file and enter vi a.c to enter the interface
You will find that the user cannot enter information from the keyboard, so we need to press an I from the keyboard to display INSERT (for insertion) below.
You can then use the keyboard to enter the code. After the input is completed, you can press Esc to exit the insert operation. Then press shift and colon at the same time to enter wq from the keyboard (for save and exit).
5. Compile the file input instruction: cc a.c (cc is the abbreviation of gcc) if no error is reported, enter ls from the keyboard to see if an executable file a.out file has been generated.
6. Permission to view the file (optional or not) use the instruction ls-lr to indicate readable w, write x, execute
7. Execute the file using the instruction. / a.out to execute the program. Output hello world!
What is Linux system Linux is a free-to-use and free-spread UNIX-like operating system, is a POSIX-based multi-user, multi-task, multi-threaded and multi-CPU operating system, using Linux can run major Unix tools, applications and network protocols.
On the Linux system how to run C language programs to share here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.