我在一个可视化 C++ 项目中使用 WinPcap 库。当我尝试编译项目时出现链接器错误,但是我已正确配置项目属性以包含适当的文件和库。这是我得到的错误:
Error LNK2019: unresolved external symbol _pcap_findalldevs_ex referenced in function _main consolewinpcap.obj
Error LNK2019: unresolved external symbol _pcap_geterr referenced in function _main consolewinpcap.obj
Error LNK2019: unresolved external symbol _pcap_next_ex referenced in function _main consolewinpcap.obj
Error LNK2019: unresolved external symbol _pcap_open referenced in function _main consolewinpcap.obj
更新 :
这是".vcproj"
文件的一部分
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=".\WinPCap\Include"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;WPCAP"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="2"
WarningLevel="3"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="wpcap.lib Packet.lib"
ShowProgress="0"
LinkIncremental="2"
AdditionalLibraryDirectories=".\WinPCap\lib"
GenerateDebugInformation="true"
SubSystem="2"
TargetMachine="1"
/>
任何帮助,将不胜感激。