Experiment 4: Linux system to build a C language programming environment

project content
This work belongs courses Course Link
Where this requirement in the job Claim
Student ID - Name 17043114- Li Qiang
Job learning objectives 1. Understand the Linux system C language programming environment 2. The learning Linux C language development environment steps

A: Installing C-language development environment

Two ubun

gcc version information

view make the version information

Two: simple c language exercises

1) Our help documentation through the man command


2) a simple command-line mode C language compiler and linker and other operations

We can write a simple C language programs by vim editor, such as writing a program output own student number. Create a folder, then enter the newly created file folder.


We finished the input source, then we were four stages of C language program is compiled, pre-compiled, compiler, assembler, linker

a) pre-compiled

b) Compile


We can open the same file with vim test.s to view the content, you can also use commands such as cat test.s

c) compilation


Generated here than text files, binary files, we can disassemble the file by objdump command to analyze the contents of the file

d) link


Executable files are binary files, also need to use the command objdump to disassemble the file contents of the file

e) running

3) multi-file compilation

We exp4 folder below to build a folder mfc (multi- fi les compile)

in the following folder create 5 files, file names are as follows:

the contents of each file are as follows:





to complete the code entered above, then we compiler for multi-file compilation, we can compile links to an executable file, you can compile each C file separately, and finally get linked executable file.


Q: Please explain the difference between the two methods?
A: one-time compiled into an executable file, each file including a plurality of resultant compiled executable file.
Next, we write a simple Make fi le, by make tools to help us compile. In the current folder Make fi le a written document

we can now make a direct input in the terminal can be compiled and linked operation

Guess you like

Origin www.cnblogs.com/liqi2/p/12586606.html