2

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.

6
  • WinPcap is a dynamic library, isn't it? Have you added the import library to your libraries to link? stackoverflow.com/questions/5218929/…
    – harper
    Sep 24, 2013 at 16:09
  • yes I did import them :/
    – Kira
    Sep 25, 2013 at 8:19
  • You could enable "Show Progress" in the Linker/General tab to see what's going on, e.g. if the library is really searched.
    – harper
    Sep 25, 2013 at 10:44
  • @harper I couldn't find where it comes from :( Please check my update
    – Kira
    Sep 27, 2013 at 9:45
  • <Tool Name="VCLinkerTool" ShowProgress="1" ... />
    – harper
    Sep 27, 2013 at 10:33

1 Answer 1

1

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.