gopacket ubuntu16.04错误未定义:pcapErrorNotActivated

时间:2019-04-05 04:56:08

标签: go gopacket

root @ ubuntu:〜/ processNet / processNet#去运行testversion.go

github.com/google/gopacket/pcap

/home/go/src/github.com/google/gopacket/pcap/pcap.go:30:22:未定义:pcapErrorNotActivated /home/go/src/github.com/google/gopacket/pcap/pcap.go:52:17:未定义:pcapTPtr /home/go/src/github.com/google/gopacket/pcap/pcap.go:64:10:未定义:pcapPkthdr


import (
        "fmt"

        "github.com/google/gopacket/pcap"
)

func main() {
        fmt.Println(pcap.Version())
}```

Already installed libpcap and c test available

1 个答案:

答案 0 :(得分:0)

仅凭libpcap是不够的,还需要libpcap-dev:

sudo apt install libpcap-dev

哪个软件包在centos中名为libpcap-devel:

sudo yum install libpcap-devel

安装后我解决了问题。