本文介绍了反编译在Ubuntu的libusb-dev的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图编译通过libusb的包中提供的示例libusb.c(如果你延胡索源$ C ​​$ C)

I am trying to compile the example libusb.c provided by libusb package (if you dl the source code.)

它不工作,至少可以说。

It doesn't work to say the least.

#include <stdio.h>
#include <sys/types.h>
#include <libusb/libusb.h>

这会导致它失败,没有的libusb / libusb.h usb.h ,所以我改变这种状况。它失败在新的和创新的方式。

That causes it to fail, there is no libusb/libusb.h it's usb.h, so I change that. And it fails in new and innovative ways.

我在复制的文件,准确,并把它命名为example.c

I've copied the file over, exactly, and named it example.c

我使用这些命令和变化:

I am using these commands and variations:

gcc -o example example.c -lusb -L /usr/lib/libusb.a
gcc -o example example.c -lusb -L /usr/lib/libusb.so

在编译时,我得到的错误是:

The errors I get when compiling are:

example.c:25: error: expected ‘)’ before ‘*’ token
example.c: In function ‘main’:
example.c:46: error: ‘libusb_device’ undeclared (first use in this function)
example.c:46: error: (Each undeclared identifier is reported only once
example.c:46: error: for each function it appears in.)
example.c:46: error: ‘devs’ undeclared (first use in this function)

Line 25: static void print_devs(libusb_device **devs)

Line 46: libusb_device **devs;

起初我也跟着教程,和无法编译,或多或少相同的方式,所以我决定只是尝试提供的示例,而失败了。

At first I followed a tutorial, and that failed to compile, in more or less the same ways, so I decided to just try the provided example, and that failed.

谁能帮我吗?解释什么是我做错了,因为我失去了在这一个。

Can anyone help me out? Explain what I am doing wrong, cause I am lost on this one.

推荐答案

这是我不得不在Debian做。它应该是在Ubuntu至少是相似的。

This is what I had to do on Debian. It should be at least similar in Ubuntu.

安装的libusb-1.0-0-dev的

而不是:

#include <libusb/libusb.h>

做的:

#include <libusb.h>

与编译:

gcc example.c `pkg-config --libs --cflags libusb-1.0`

这篇关于反编译在Ubuntu的libusb-dev的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-13 01:52