libusb的以及如何使用它包在Ubuntu [英] Libusb and how to use its packages in Ubuntu

查看:345
本文介绍了libusb的以及如何使用它包在Ubuntu的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用以下命令安装libusb的。我不知道这是否是正确与否,命令是

 命令和apt-get安装的libusb-dev的

在我已经安装(如果已经安装或没有,因为我的Ubuntu的初级用户,我不知道),我想知道我会如何使用图书馆,因为我写的一些示例code这使用< libusb.h>,但是当我编译C ++文件中使用

  G ++ test_libusb.cpp

这引发以下错误,


  

test_libusb.cpp:2:20:​​致命错误:libusb.h:没有这样的文件或目录汇编终止


我无言以对做什么。我不能在互联网上找到任何来源去的这条底线...

我想知道这里两件事情:


  1. 如何添加libusb库中的C / C ++,所以我可以使用<?libusb.h>

  2. 将一些样本code是什么?只有几行,看看libusb的工作......


解决方案

在看一看<一个href=\"http://packages.debian.org/wheezy/i386/libusb-dev/filelist\">http://packages.debian.org/wheezy/i386/libusb-dev/filelist:您要包括的文件是 usb.h 。此外,你必须告诉编译器哪里能找到编译后的库函数: -lusb 添加到编译器命令行,使其加载 libusb.so

I have installed libusb by using the following command. I am not sure if it was right or not and the command was

sudo apt-get install libusb-dev

Once I have installed (and I am not sure if it has installed or not because I am a novice user of Ubuntu), I want to know how would I use the library, because I write some sample code which uses <libusb.h>, but when I compile that C++ file using

g++ test_libusb.cpp

that throws the following error,

test_libusb.cpp:2:20: fatal error: libusb.h: No such file or directory compilation terminated.

I am clueless what to do. I can't find any source on the Internet to get to the bottom of this...

I want to know two things here:

  1. How do I add the libusb library in C/C++ so I can use <libusb.h>?
  2. What would some sample code be? Only a few lines to see if libusb is working...

解决方案

Have a look at http://packages.debian.org/wheezy/i386/libusb-dev/filelist: The file you want to include is usb.h. Also, you'll have to tell the compiler where it can find the compiled library functions: Add -lusb to the compiler command line to make it load libusb.so.

这篇关于libusb的以及如何使用它包在Ubuntu的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆