pcap 函数出现未解析的外部符号 (LNK 2001) 错误

unresolved external symbol (LNK 2001) error with pcap functions

我知道如何修复 MSVS (2013) 中的典型 LNK2019 错误,但我在尝试使用 winpcap 时遇到了一些额外的麻烦..

我从 this site (a couple times, actually), which supposedly installed the necessary .dlls I need, and I also installed the developer kit and pointed the linker to it as so: (1), (2) 安装了 winpcap。

我将 WIN32 放在我的预处理器指令(或者更确切地说,定义)中,这消除了编译错误。但是,当我 运行 这个 post 底部的测试代码时,我得到 these errors.

此处测试代码:http://pastie.org/10730081

查看 your screenshot,您已将路径添加到 64 位和 32 位库文件。如果库的开发人员不注意为其 64 位和 32 位版本使用不同的名称,那么链接器将无法找到正确的函数。

它首先在 64 位文件夹中搜索(因为这是您首先列出的文件夹),但您正在编译针对 32 位架构的应用程序("Win32" 项目配置处于活动状态) .

修复很简单:确保您已将 "Library Directories" 与您的项目配置相匹配:

Win32 → C:\code\C++\libs\WpdPack\Lib\
x64 → C:\code\C++\libs\WpdPack\Lib\x64\