0

I know how to fix typical LNK2019 errors in MSVS (2013) but I'm having some extra trouble when trying to use winpcap..

I installed winpcap from 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).

I placed WIN32 in my preprocessor directives (or rather, defines), which took away compilation errors. However, when I run the test code at the bottom of this post, I get these errors.

Test code here: http://pastie.org/10730081

galois
  • 777
  • 1
  • 10
  • 28
  • You are pointing the linker to both the 64-bit and 32-bit versions of the library files. If they did not use different names, you will have a problem. The linker can't find the right functions. Match up the "Library Directories" with your project configuration ("Win32"/"x64"). – Cody Gray Feb 20 '16 at 11:14
  • If you make your comment an answer, I'll accept it. thanks – galois Feb 20 '16 at 11:17
  • Well, it's compiling and linking now, and I'm getting correct output, so yep – galois Feb 20 '16 at 11:23
  • Okay, done. Glad you got it sorted! – Cody Gray Feb 20 '16 at 11:26

1 Answers1

1

Looking at your screenshot, you have added the paths to both the 64-bit and 32-bit library files. If the developers of the library were not careful to use different names for their 64-bit and 32-bit editions, then the linker won't be able to find the right functions.

It is searching first in the 64-bit folder (because that's the one you have listed first), but you are compiling the application targeting a 32-bit architecture (the "Win32" project configuration is active).

The fix is simple: make sure that you have matched up the "Library Directories" with your project configuration:

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

Cody Gray
  • 230,875
  • 49
  • 477
  • 553