Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Linux system compiling and running files

2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

Linux system compiles and runs files. In view of this problem, this article introduces the corresponding analysis and solution in detail, hoping to help more partners who want to solve this problem to find a more simple and feasible method.

Linux system compiling and running files

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:

Of course, it is best to use the command to update the software before installing all the software.

3. Before creating a folder and entering the file to create a folder, you can use the instruction ls to see what files are on the system. 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!

This is the answer to the question about the compilation and running files of the Linux system. I hope the above content can be of some help to you. If you still have a lot of doubts to be solved, you can follow the industry information channel to learn more about it.

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.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report