unresolved external symbol for WinUsb_ReadPipe?

I am trying to write an application that uses the winusb. I do have winusb.h included but I got LNK2019 errors for all the methods from winusb.h being called in the application I wrote. Could some one please help me how to fix this? Below is an example of the errors I got.

Error 1 error LNK2019: unresolved external symbol xxxxx@8 referenced in function xxxxx@8 C:\Users\Trey\Documents\GitRepo\FSCC_USB_driver\Sample KMDF Function Driver for OSR USB-FX2\C++\exe\testapp.obj osrusbfx2 (Exe\osrusbfx2)

Thanks,

Are you linking against winusb.lib?

Sent from Outlook Mailhttp: for Windows 10

From: xxxxx@gmail.com
Sent: Wednesday, June 24, 2015 9:53 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] unresolved external symbol for WinUsb_ReadPipe?

I am trying to write an application that uses the winusb. I do have winusb.h included but I got LNK2019 errors for all the methods from winusb.h being called in the application I wrote. Could some one please help me how to fix this? Below is an example of the errors I got.

Error 1 error LNK2019: unresolved external symbol xxxxx@8 referenced in function _GetWinUSBHandle@8 C:\Users\Trey\Documents\GitRepo\FSCC_USB_driver\Sample KMDF Function Driver for OSR USB-FX2\C++\exe\testapp.obj osrusbfx2 (Exe\osrusbfx2)

Thanks,


NTDEV is sponsored by OSR

Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev

OSR is HIRING!! See http://www.osr.com/careers

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer</http:>

Hi Doron,

What do you mean by link against? I am using Visual Studio 2013. I included the winusb.h. Is there other things I need to do to link to the library?

Thanks,

Qi

WinUsb.h declares the WinUsb function prototypes so that your code can compile, but you need to link to the library that actually implements those functions in order to assemble your final executable. See this for VS specifically:

http://stackoverflow.com/questions/6287338/library-importing-pragma-comment-vs-visual-studio-project-input

You need to configure the project’s linker settings and add $(SDK_LIB_PATH)\winusb.lib to the list of libraries you are linking against

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@gmail.com
Sent: Wednesday, June 24, 2015 10:03 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] unresolved external symbol for WinUsb_ReadPipe?

Hi Doron,

What do you mean by link against? I am using Visual Studio 2013. I included the winusb.h. Is there other things I need to do to link to the library?

Thanks,

Qi


NTDEV is sponsored by OSR

Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev

OSR is HIRING!! See http://www.osr.com/careers

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

xxxxx@gmail.com wrote:

What do you mean by link against? I am using Visual Studio 2013. I included the winusb.h. Is there other things I need to do to link to the library?

Of course you do. The “include” file gets you the compile-time
definitions. Somehow, the linker has to find an object file that has
the actual code. When you call GetDC, that gets satisfied by
gdi32.lib. When you call GetMessage, that gets satisfied by
user32.lib. When you make socket calls, you have to specify the Winsock
library, ws2_32.lib. It’s the same thing here.

Add this:
#pragma comment( lib, “winusb.lib” )


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

Thank you Tim. I added “#pragma comment( lib, “winusb.lib” )” and the problem is gone now.

Add this:
#pragma comment( lib, “winusb.lib” )
:slight_smile:
it never ceases to amaze how simple things are buried under the
mososauristic yobibytes of project settings :slight_smile:

On 6/24/15, xxxxx@gmail.com wrote:
> Thank you Tim. I added “#pragma comment( lib, “winusb.lib” )” and the
> problem is gone now.
>
> —
> NTDEV is sponsored by OSR
>
> Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
>
> OSR is HIRING!! See http://www.osr.com/careers
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>

> mososauristic yobibytes

Thanks, you enriched my English again :slight_smile:

Why “mososauristic”, why not “brontosauristic”? or “tyrannosauristic”?


Maxim S. Shatskih

Microsoft MVP on File System And Storage

xxxxx@storagecraft.com

http://www.storagecraft.com

:stuck_out_tongue: omg thanks you just reimbursed me Rs 1k and made me younger by 3
hours which i spent wikiing imdbing youtubing whatnotting and
conceding defeat to my daughter who claimed mosa eats tyra

On 6/25/15, Maxim S. Shatskih wrote:
>> mososauristic yobibytes
>
> Thanks, you enriched my English again :slight_smile:
>
> Why “mososauristic”, why not “brontosauristic”? or “tyrannosauristic”?
>
> –
> Maxim S. Shatskih
>
> Microsoft MVP on File System And Storage
>
> xxxxx@storagecraft.com
>
> http://www.storagecraft.com
>
>
>
> —
> NTDEV is sponsored by OSR
>
> Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
>
> OSR is HIRING!! See http://www.osr.com/careers
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>