看板 FreeBSD 關於我們 聯絡資訊
※ 引述《harddriver (HD)》之銘言: : 在freebsd下用port安裝了libnet後… : 在t.c裡面使用 : #include <libnet.h> : 使用gcc t.c -o t -lnet出現 : t.c:2:20: error: libnet.h: No such file or directory : ldconfig -r 也有看到 -lnet : 這是為什麼呢? 屬於 FreeBSD OS 本體以外的東西會被裝在 /usr/local 下面, 所以你要加上 -I/usr/local/include 才行, 同樣的 link 的路徑也是要像 -L/usr/local/lib 這樣加。 我沒有裝這個 ports 所以不清楚 pkg-config 有沒有支援, 如果有的話可以這樣下: gcc `pkg-config --cflags libnet` t.c -o t `pkg-config --libs libnet` 有支援的話應該就會幫你弄好正確的參數。 -- Ling-hua Tseng ([email protected]) Department of Computer Science, National Tsing-Hua University Interesting: C++, Compiler, PL/PD, OS, VM, Large-scale software design Researching: Software pipelining for VLIW architectures Homepage: http://www.tinlans.org -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 118.160.117.59 ※ 編輯: tinlans 來自: 118.160.117.59 (02/01 01:00)