Neu4Swift
Neu4Swift

Reputation: 335

where can I set that libpcap library in Mac/XCode?

the linker returns: Ld Build/Products/Debug/PCap normal x86_64 cd ~/PCap export MACOSX_DEPLOYMENT_TARGET=10.12 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.\ xctoolchain/usr/bin/clang++ -arch x86_64 -isysroot /Applications/Xcode.app/\ Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk \ -L~/PCap/Build/Products/Debug -F~/PCap/Build/Products/Debug -filelist \ ~/PCap/Build/Intermediates/PCap.build/Debug/PCap.build/Objects-normal\ /x86_64/PCap.LinkFileList -mmacosx-version-min=10.12 \ -Xlinker -object_path_lto -Xlinker \ ~/PCap/Build/Intermediates/PCap.build/Debug/PCap.build/Objects-normal/x86_64/PCap_lto.o \ -Xlinker -export_dynamic -Xlinker -no_deduplicate -stdlib=libc++ -Xlinker \ -dependency_info -Xlinker ~/PCap/Build/Intermediates/PCap.build/Debug/PCap.build/Objects-normal\ /x86_64/PCap_dependency_info.dat -o ~/PCap/Build/Products/Debug/PCap

Undefined symbols for architecture x86_64: "_pcap_compile", referenced from: _main in main.o "_pcap_findalldevs", referenced from: _main in main.o "_pcap_lookupnet", referenced from: _main in main.o "_pcap_loop", referenced from: _main in main.o "_pcap_open_live", referenced from: _main in main.o "_pcap_setfilter", referenced from: _main in main.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

I think - he is missing that library. But which name? The finder can't find anything as 'pcap'. If I install libpcap with brew, I got: cap already installed. And brew: macOS already provides this software and installing another version in parallel can cause all kinds of trouble. Has someone used pcap on Mac/OS X? And can help? I have reduced my source to a very small example - but got this errors...

Upvotes: 0

Views: 1204

Answers (1)

srnand
srnand

Reputation: 11

You just need to link the pcap by using -lpcap. Then it should work.

Upvotes: 1

Related Questions