Under Linux, use the command to compile
Using the gcc -c file.c command will generate a corresponding file.o.
After compiling all the .c files, use the command gcc ao bo co -o main to generate a linux executable file in the current directory
Then use the ./main command to run the C program
Take the previous simple linked list as an example
[root@iZwz94jyld0skyrwc1772eZ yeyeck]# ll
total 12
-rw-r--r-- 1 root root 1795 Sep 8 21:16 list.c
-rw-r--r-- 1 root root 1583 Sep 8 21:16 list.h
-rw-r--r-- 1 root root 1956 Sep 8 21:16 movies.c
[root@iZwz94jyld0skyrwc1772eZ yeyeck]# gcc -c list.c
[root@iZwz94jyld0skyrwc1772eZ yeyeck]# ll
total 16
-rw-r--r-- 1 root root 1795 Sep 8 21:16 list.c
-rw-r--r-- 1 root root 1583 Sep 8 21:16 list.h
-rw-r--r-- 1 root root 2712 Sep 8 21:28 list.o
-rw-r--r-- 1 root root 1956 Sep 8 21:16 movies.c
[root@iZwz94jyld0skyrwc1772eZ yeyeck]# gcc -c movies.c
[root@iZwz94jyld0skyrwc1772eZ yeyeck]# ll
total 20
-rw-r--r-- 1 root root 1795 Sep 8 21:16 list.c
-rw-r--r-- 1 root root 1583 Sep 8 21:16 list.h
-rw-r--r-- 1 root root 2712 Sep 8 21:28 list.o
-rw-r--r-- 1 root root 1956 Sep 8 21:16 movies.c
-rw-r--r-- 1 root root 4000 Sep 8 21:28 movies.o
[root@iZwz94jyld0skyrwc1772eZ yeyeck]# gcc movies.o list.o -o movies
[root@iZwz94jyld0skyrwc1772eZ yeyeck]# ll
total 36
-rw-r--r-- 1 root root 1795 Sep 8 21:16 list.c
-rw-r--r-- 1 root root 1583 Sep 8 21:16 list.h
-rw-r--r-- 1 root root 2712 Sep 8 21:28 list.o
-rwxr-xr-x 1 root root 13480 Sep 8 21:29 movies
-rw-r--r-- 1 root root 1956 Sep 8 21:16 movies.c
-rw-r--r-- 1 root root 4000 Sep 8 21:28 movies.o
[root@iZwz94jyld0skyrwc1772eZ yeyeck]# ./movies
Enter first movie title:
yyy
Enter your rating <0-10>:
5
Enter next movie title (empty line to stop):
uuu
Enter your rating <0-10>:
6
Enter next movie title (empty line to stop):
iii
Enter your rating <0-10>:
3
Enter next movie title (empty line to stop):
Here is the mpvie list:
Movie: yyy, Rating: 5
Movie: uuu, Rating: 6
Movie: iii, Rating: 3
You entered 3 movies.
Bye!
[root@iZwz94jyld0skyrwc1772eZ yeyeck]#