VC程序编译时的问题 出现LINK错误

来源:百度知道 编辑:UC知道 时间:2024/06/28 12:40:36
毕业设计要利用WINPCAP抓包
找了源程序
如下:
#include <pcap.h>
#include <remote-ext.h>
/* Prototype of the packet handler */
void packet_handler(u_char *param, const struct pcap_pkthdr *header, const u_char *pkt_data);
int main() {
pcap_if_t *alldevs;
pcap_if_t *d;
int inum;
int i = 0;
pcap_t *adhandle;
char errbuf[PCAP_ERRBUF_SIZE];
/* Retrieve the devices list on the local machine */
if (pcap_findalldevs_ex(PCAP_SRC_IF_STRING, NULL, &alldevs, errbuf) == -1)
{
fprintf(stderr, "Error in pcap_findalldevs: %s\n", errbuf);
exit(1);
}
/* Print the list */
for (d = alldevs; d; d = d->next)
{
/* Print name */
printf("%d. %s", ++ i, d->name);
/* Print description */
if (d->description)
{
printf(" (%s)\n", d->description);
}
else
{ <

我记得用Winpcap的时候,如果要使用某些特殊函数,应当在包含头文件前预定义一些宏,名字可能是WPCAP、HAVE_REMOTE之类。用法你可以参看文档:
http://www.winpcap.org/docs/docs_40/html/group__wpcapsamps.html