How to use npcap in VSCode

602 Views Asked by At

I am trying to use npcap SDK in VScode on Windows 10 computer.

I've written the correct path to Include directory and Lib directory of the SDK in file c_cpp_properties.json and proper command in file tasks.json.

But when I ran my test.c file, it didn't compile successfully.


Here is the output of the console:

Executing task: D:\Software\MinGW\mingw-w64\mingw64\bin\gcc.exe -g d:\workspace\c\npcapTest\test.c -I D:\Software\wireshark\npcap_sdk\npcap-sdk-1.05\Include -L D:\Software\wireshark\npcap_sdk\npcap-sdk-1.05\Lib\X64 -o d:\workspace\c\npcapTest\test.exe <


C:\Users\Aoki\AppData\Local\Temp\cch72D04.o: In function `main':

d:/workspace/c/npcapTest/test.c:16: undefined reference to `pcap_findalldevs_ex'

d:/workspace/c/npcapTest/test.c:38: undefined reference to `pcap_freealldevs'
collect2.exe: error: ld returned 1 exit status

It seems that something went wrong when linking to the .dll file. I've tried many methods, but I still don 't know how to solve this problem.

I'm new here, I can't upload pictures...

0

There are 0 best solutions below