Hey so I have been trying to get the WinPcap libraries to work with Dev C++ for the last couple days and have had no luck. It seems everyone else is having the same problems as I checked the internet and all I seem to find is reports of this problems but no solutions. So I will try to make this as understandable as possible. I installed the appropriate drivers for the libraries. I have saved the contents of the WinPcap libraries into Dev C++'s lib folder. I saved the required includes (.h files) into the the include folder in the Dev C++ directory. I then made some changes to one of the C examples provided, and created a new C++ project. I linked to wpcap.lib and libws2_32.a and then compiled it. Here is the code and error I got.
/* Retrieve the device list from the local machine */
if (pcap_findalldevs_ex(PCAP_SRC_IF_STRING, NULL, &alldevs, errbuf) == -1)
cout << "Error in pcap_findalldevs_ex: %s\n";
/* Print the list */
for(d= alldevs; d != NULL; d= d->next)
printf("%d. %s", ++i, d->name);
printf(" (%s)\n", d->description);
printf(" (No description available)\n");
if (i == 0)
printf("\nNo interfaces found! Make sure WinPcap is installed.\n");
/* We don't need any more the device list. Free it */
For some reason it isn't registering that certain functions are in the library. I also linked to libwpcap.a just to be sure but nothing changed. Also I know there are other errors in the code I.E. me not defining any standard libraries but this is just to illustrate a point and get the problem fixed im actually just using these select functions in a much bigger project and just posted this as a quick demo. Any thoughts?
Compiler: Default compiler
Building Makefile: "C:\Users\Scott\Documents\c++ workspace\scoket workspace\syn test v1\Makefile.win"
make.exe -f "C:\Users\Scott\Documents\c++ workspace\scoket workspace\syn test v1\Makefile.win" all
g++.exe -c main.cpp -o main.o -I"C:/Program_Files/Dev-Cpp/lib/gcc/mingw32/3.4.2/include" -I"C:/Program_Files/Dev-Cpp/include/c++/3.4.2/backward" -I"C:/Program_Files/Dev-Cpp/include/c++/3.4.2/mingw32" -I"C:/Program_Files/Dev-Cpp/include/c++/3.4.2" -I"C:/Program_Files/Dev-Cpp/include"
main.cpp: In function `int main()':
main.cpp:11: error: `PCAP_SRC_IF_STRING' undeclared (first use this function)
main.cpp:11: error: (Each undeclared identifier is reported only once for each function it appears in.)
main.cpp:11: error: `pcap_findalldevs_ex' undeclared (first use this function)
main.cpp:13: error: `cout' undeclared (first use this function)
make.exe: *** [main.o] Error 1