Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I am having problem figure out how to use libusb, I put "libusb-1.0.18-rc1libusb" in include directories (using Visua Studio), but it doesn't work.

Can anyone enlighten me. Thanks a lot!

error message:

1>test.obj : error LNK2019: unresolved external symbol _libusb_exit@4 referenced in   function _main
1>test.obj : error LNK2019: unresolved external symbol _libusb_close@4 referenced in function _main
1>test.obj : error LNK2019: unresolved external symbol _libusb_release_interface@8 referenced in function _main
1>test.obj : error LNK2019: unresolved external symbol _libusb_bulk_transfer@24 referenced in function _main
1>test.obj : error LNK2019: unresolved external symbol _libusb_claim_interface@8 referenced in function _main
1>test.obj : error LNK2019: unresolved external symbol _libusb_detach_kernel_driver@8 referenced in function _main
1>test.obj : error LNK2019: unresolved external symbol _libusb_kernel_driver_active@8 referenced in function _main
1>test.obj : error LNK2019: unresolved external symbol _libusb_free_device_list@8 referenced in function _main
1>test.obj : error LNK2019: unresolved external symbol _libusb_open_device_with_vid_pid@12 referenced in function _main
1>test.obj : error LNK2019: unresolved external symbol _libusb_get_device_list@8 referenced in function _main
1>test.obj : error LNK2019: unresolved external symbol _libusb_set_debug@8 referenced in function _main
1>test.obj : error LNK2019: unresolved external symbol _libusb_init@4 referenced in function _main
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
251 views
Welcome To Ask or Share your Answers For Others

1 Answer

If you havne't done so already you will need to build the libraries you will be linking to, they are located in libusb-1.0.18-rc1msvc. There are multiple projects there depending on your Visual Studio version and whether you want a DLL or a static LIB file.

In either case you will need to right click on your project, then under Configuration Properties -> Linker -> Input -> Additional Dependencies add a reference to the LIB file you created. If you are linking to the static LIB file you're done, it will build the code in to your executable. If you're linking to the LIB file for the DLL make sure the DLL is available in your execution path. In either case this should resolve your unresolved externals.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...