C++ 在 Windows 7 上安装 libusb-1.0

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20315797/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-27 23:03:10  来源:igfitidea点击:

Installing libusb-1.0 on Windows 7

c++windowslibusb

提问by user3055073

It seems that the easiest way to install libusb-1.0.9 onto Windows 7 for use in Visual C++is to use Cygwinor similar software to build and install it to my computer. Is there an easier way to do it that I have not found, or am I going about this all wrong?

似乎将 libusb-1.0.9 安装到 Windows 7 以用于Visual C++的最简单方法是使用Cygwin或类似软件构建并将其安装到我的计算机上。有没有更简单的方法可以做到这一点,我还没有找到,还是我做错了?

I would like to use libusb to communicate with an Arduino Due, and development will be done in Visual Studio (and maybe Dev-C++).

我想使用 libusb 与Arduino Due进行通信,开发将在 Visual Studio(也许Dev-C++)中完成。

回答by Preston

You can use libusb-win32for this.

您可以为此使用libusb-win32

To install libusb on Windows 7 download the bin package for libusb-win32(this link points to version 1.2.6). Then go to the bin directory and run inf-wizard.exe. Here is where you can customize and generate an INF installation file for your device, as well as the installer executables. Select the same bin directory you are running from to place the output of the tool (so that the INF file is next to the x86, amd64and ia64directories).

要在 Windows 7 上安装 libusb,请下载 libusb-win32 的 bin 包(此链接指向版本 1.2.6)。然后转到 bin 目录并运行inf-wizard.exe. 您可以在此处为您的设备以及安装程序可执行文件自定义和生成 INF 安装文件。选择您正在运行的同一个 bin 目录来放置工具的输出(这样 INF 文件就在x86,amd64ia64目录旁边)。

Now you can run the installation executable. You can also go to Device Manager and right click your device and choose "Update Driver Software" and point directly at your generated INF file.

现在您可以运行安装可执行文件。您也可以转到设备管理器并右键单击您的设备并选择“更新驱动程序软件”并直接指向您生成的 INF 文件。

At this point your device should be loaded, so you should be able to communicate with it by including the lusb0_usb.hfile in your project (located in the includedirectory) and linking your project to the appropriate LIB file in the libdirectory. The API can be found here.

此时应该加载您的设备,因此您应该能够通过将lusb0_usb.h文件包含在您的项目中(位于include目录中)并将您的项目链接到lib目录中相应的 LIB 文件来与其进行通信。可以在此处找到API 。