cd、ls、gcc、make// helloworld.c
#include <stdio.h>
int main(void) { printf("hello, world\n"); return 0; }
gcc -o helloworld helloworld.c
./helloworld
main.c // 主程式
mytool1.c/.h // 工具模組 1
mytool2.c/.h // 工具模組 2
main: main.o mytool1.o mytool2.o
gcc -o main main.o mytool1.o mytool2.o
main.o: main.c mytool1.h mytool2.h
gcc -c main.c
mytool1.o: mytool1.c mytool1.h
gcc -c mytool1.c
mytool2.o: mytool2.c mytool2.h
gcc -c mytool2.c
make
./main
輸出:This is mytool1 print hello / This is mytool2 print hello
./configure && make && make install # 安裝至 /home/user/libxml
gcc -o app app.c -I/home/user/libxml/include -L/home/user/libxml/lib -lxml2
-I:標頭檔搜尋路徑-L:庫檔搜尋路徑-lxml2:連結 libxml2.so/a./app input.xml
解析 XML 並輸出結構化資料。示範真實專案的「原始碼→Makefile→外部庫→執行」完整工具鏈。