Link error LNK2019 redux  
Author Message
ac30boy





PostPosted: Visual C++ General, Link error LNK2019 redux Top

I reviewed the previous thread but couldn't resolve my issue using the info there. The errors I'm getting are:



Error 2 error LNK2001: unresolved external symbol _USB_1208LS_GUID USBReaderC.obj

I found the lib file that contains the function and manually added it to my list of link directories to search, but that didn't work.

Some other hopefully useful information:

This is intended to be a simple Win32 console application I'm using to debug some things going on at a USB port. I'm running Windows XP SP2, the devel environment is Visual Studio 2005 Pro. I'm using the DEFINE_GUID macro which doesn't seem to be functioning correctly, hence Error 2 above.

Is there something I'm doing wrong in setting up the project

The compile command line:
/Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_AFXDLL" /Gm /RTC1 /MDd /Yc"stdafx.h" /Fp"Debug\USBReaderC.pch" /Fo"Debug\\" /Fd"Debug\vc80.pdb" /W3 /nologo /c /ZI /Gz /TP /errorReport:prompt

The link command line:
/VERBOSE /OUT:"H:\Development\Barcode Reader\app\USBReaderC\Debug\USBReaderC.exe" /INCREMENTAL /NOLOGO /LIBPATH:"H:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\Lib" /MANIFEST /MANIFESTFILE:"Debug\USBReaderC.exe.intermediate.manifest" /DEBUG /PDB:"h:\Development\Barcode Reader\app\USBReaderC\debug\USBReaderC.pdb" /SUBSYSTEM:CONSOLE /MACHINE:X86 /ERRORREPORT:PROMPT

Thanks in advance for any assistance,

Tom





Visual C++4  
 
 
ac30boy





PostPosted: Visual C++ General, Link error LNK2019 redux Top

I should also mention I have VC 6.0 installed in the same machine. I'm now checking to see if this is affecting me in some obvious way.

 
 
Mike Danes





PostPosted: Visual C++ General, Link error LNK2019 redux Top

You need to add the lib itself (setupapi.lib) to the linker input, not only the directory where it is.

 


 
 
nobugz





PostPosted: Visual C++ General, Link error LNK2019 redux Top

#include <initguid.h> before #include <guiddef.h> in the source code file where you use the DEFINE_GUID macro.


 
 
ac30boy





PostPosted: Visual C++ General, Link error LNK2019 redux Top

Thanks, Mike!

That fixed the lnk2019 issue!

Onto the lnk2001 issue....

 
 
ac30boy





PostPosted: Visual C++ General, Link error LNK2019 redux Top

Thanks, nobugz!

That nailed it!