I'm using WinPcap library in a visual C++ project. When I try to compile the project I get linker errors however I've correctly configured the project properties to include the appropriate files and libraries. Here are the errors I got :

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

UPDATE :

Here is a part of the ".vcproj" file

<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"
/>

Any help would be appreciated.

有帮助吗?

解决方案

When you are doubt about the linker process it's useful to enable the "Show Progress" option. You find it in the Linker/General tab.

If you don't use the GUI you can also change the .vcproject file. You find it here:

<Tool Name="VCLinkerTool"
    ShowProgress="1"
    ...
/>
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top