在Debian系統中,使用GCC編譯時,可以通過-I
選項來指定頭文件路徑
gcc -I/path/to/headers -o output_file source_file.c
這里,/path/to/headers
是你想要指定的頭文件路徑,output_file
是編譯后生成的可執行文件名,source_file.c
是源代碼文件。
如果你有多個頭文件路徑,可以使用多個-I
選項:
gcc -I/path/to/headers1 -I/path/to/headers2 -o output_file source_file.c
此外,你還可以通過設置環境變量CFLAGS
來指定頭文件路徑:
export CFLAGS="-I/path/to/headers"
gcc -o output_file source_file.c
這樣,CFLAGS
中指定的頭文件路徑將被添加到編譯器的默認搜索路徑中。