root@ubuntu:~/processNet/processNet# go run testversion.go
github.com/google/gopacket/pcap
/home/go/src/github.com/google/gopacket/pcap/pcap.go:30:22: undefined: pcapErrorNotActivated/home/go/src/github.com/google/gopacket/pcap/pcap.go:52:17: undefined: pcapTPtr/home/go/src/github.com/google/gopacket/pcap/pcap.go:64:10: undefined: pcapPkthdr
import (
"fmt"
"github.com/google/gopacket/pcap"
)
func main() {
fmt.Println(pcap.Version())
}```
Already installed libpcap and c test available
libpcap 本身是不够的,libpcap-dev 也是必需的:
sudo apt install libpcap-dev
哪个软件包在 CentOS 中被命名为 libpcap-devel:
sudo yum install libpcap-devel
安装后我解决了我的问题。