简体   繁体   English

libpcap不链接netbeans

[英]libpcap not linking netbeans

I have been trying to learn libpcap on my mac. 我一直在尝试在Mac上学习libpcap。 I am using netbeans IDE. 我正在使用netbeans IDE。 I downloaded libpcap from tcpdump.org and tried to run a sample application from http://yuba.stanford.edu/~casado/pcap/section1.html . 我从tcpdump.org下载了libpcap,并尝试从http://yuba.stanford.edu/~casado/pcap/section1.html运行示例应用程序。

I get these errors: 我得到这些错误:

Undefined symbols for architecture x86_64:
  "_pcap_lookupdev", referenced from:
      _main in main.o
  "_pcap_lookupnet", referenced from:
      _main in main.o

I tried to manually link libpcap to netbeans by right clicking on project-name->properties and adding the libpcap folder to Build->C++ compiler->Include Directories . 我尝试通过右键单击project-name-> properties并将libpcap文件夹添加到Build->C++ compiler->Include Directories来手动将libpcap链接到netbeans。 Pretty stumped. 很难过。

Beside the include directories (= headers) you have to add the library too! 除了包含目录(=标头)之外,您还必须添加

At Build -> Linker settings, add libpcap to Libraries ; Build -> Linker设置中,将libpcap添加到Libraries if not found - eg. 如果找不到-例如 you haven't placed it in default directories, add the path at Additional Library Directories . 您尚未将其放置在默认目录中,请在“ Additional Library Directories添加路径。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM