• «
  • 1
  • 2
  • »
  • Pages: 1/2     Go
主题 : 交叉编译提示找不到usb.h 复制链接 | 浏览器收藏 | 打印
级别: 新手上路
UID: 7382
精华: 0
发帖: 18
金钱: 180 两
威望: 115 点
综合积分: 36 分
注册时间: 2009-07-13
最后登录: 2010-03-12
楼主  发表于: 2009-08-20 13:58

 交叉编译提示找不到usb.h

我的是micro2440的板子,交叉编译器4.3.2,完全按照说明做的
交叉编译usb_modeswitch,提示找不到usb.h,过程如下

[root@localhost usb_modeswitch-1.0.2]# cd /home/linux-2.6.29/include/linux/
[root@localhost linux]# cd /home/usb_modeswitch-1.0.2/
[root@localhost usb_modeswitch-1.0.2]# make
arm-linux-gcc -l usb -o usb_modeswitch usb_modeswitch.c
usb_modeswitch.c:61:17: error: usb.h: No such file or directory 就是这里啦
usb_modeswitch.c: In function 'main':
usb_modeswitch.c:358: error: dereferencing pointer to incomplete type
usb_modeswitch.c:358: error: dereferencing pointer to incomplete type
usb_modeswitch.c:360: warning: assignment makes pointer from integer without a cast
usb_modeswitch.c:367: error: dereferencing pointer to incomplete type
usb_modeswitch.c:369: error: dereferencing pointer to incomplete type
usb_modeswitch.c: In function 'deviceDescription':
usb_modeswitch.c:493: error: dereferencing pointer to incomplete type
usb_modeswitch.c:494: error: dereferencing pointer to incomplete type
usb_modeswitch.c:503: error: dereferencing pointer to incomplete type
usb_modeswitch.c:504: error: dereferencing pointer to incomplete type
usb_modeswitch.c:513: error: dereferencing pointer to incomplete type
usb_modeswitch.c:514: error: dereferencing pointer to incomplete type
usb_modeswitch.c: In function 'switchHuaweiMode':
usb_modeswitch.c:697: error: 'USB_TYPE_STANDARD' undeclared (first use in this function)
usb_modeswitch.c:697: error: (Each undeclared identifier is reported only once
usb_modeswitch.c:697: error: for each function it appears in.)
usb_modeswitch.c:697: error: 'USB_RECIP_DEVICE' undeclared (first use in this function)
usb_modeswitch.c:697: error: 'USB_REQ_SET_FEATURE' undeclared (first use in this function)
usb_modeswitch.c: In function 'switchSonyMode':
usb_modeswitch.c:758: warning: assignment makes pointer from integer without a cast
usb_modeswitch.c: In function 'checkSuccess':
usb_modeswitch.c:832: warning: assignment makes pointer from integer without a cast
usb_modeswitch.c: In function 'search_devices':
usb_modeswitch.c:910: warning: assignment makes pointer from integer without a cast
usb_modeswitch.c:910: error: dereferencing pointer to incomplete type
usb_modeswitch.c:912: error: dereferencing pointer to incomplete type
usb_modeswitch.c:912: error: dereferencing pointer to incomplete type
usb_modeswitch.c:913: error: dereferencing pointer to incomplete type
usb_modeswitch.c:913: error: dereferencing pointer to incomplete type
usb_modeswitch.c:915: error: dereferencing pointer to incomplete type
usb_modeswitch.c:917: error: dereferencing pointer to incomplete type
usb_modeswitch.c: In function 'find_first_bulk_output_endpoint':
usb_modeswitch.c:934: error: dereferencing pointer to incomplete type
usb_modeswitch.c:937: error: dereferencing pointer to incomplete type
usb_modeswitch.c:938: error: dereferencing pointer to incomplete type
usb_modeswitch.c:939: error: dereferencing pointer to incomplete type
usb_modeswitch.c:939: error: 'USB_ENDPOINT_TYPE_MASK' undeclared (first use in this function)
usb_modeswitch.c:939: error: 'USB_ENDPOINT_TYPE_BULK' undeclared (first use in this function)
usb_modeswitch.c:940: error: dereferencing pointer to incomplete type
usb_modeswitch.c:940: error: 'USB_ENDPOINT_DIR_MASK' undeclared (first use in this function)
usb_modeswitch.c:941: error: dereferencing pointer to incomplete type
usb_modeswitch.c: In function 'find_first_bulk_input_endpoint':
usb_modeswitch.c:951: error: dereferencing pointer to incomplete type
usb_modeswitch.c:954: error: dereferencing pointer to incomplete type
usb_modeswitch.c:955: error: dereferencing pointer to incomplete type
usb_modeswitch.c:956: error: dereferencing pointer to incomplete type
usb_modeswitch.c:956: error: 'USB_ENDPOINT_TYPE_MASK' undeclared (first use in this function)
usb_modeswitch.c:956: error: 'USB_ENDPOINT_TYPE_BULK' undeclared (first use in this function)
usb_modeswitch.c:957: error: dereferencing pointer to incomplete type
usb_modeswitch.c:957: error: 'USB_ENDPOINT_DIR_MASK' undeclared (first use in this function)
usb_modeswitch.c:958: error: dereferencing pointer to incomplete type
make: *** [usb_modeswitch] 错误? 1


请教下我应该把usb.h及相关文件从哪里拷贝到哪里呢?前辈们帮帮忙
[ 此帖被yyh572103在2009-08-20 14:49重新编辑 ]
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
1楼  发表于: 2009-08-20 14:49
理论上可以放到任何目录下,把该目录用"-I /path/to/directory/contaning/usb.h"参数加到arm-linux-gcc的命令行上就可以了
"If you have an apple and I have an apple and we exchange apples, then you and I will
still each have one apple. But if you have an idea and I have an idea and we exchange
these ideas, then each of us will have two ideas."
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
2楼  发表于: 2009-08-20 14:52
不过我好像没看到micro2440手册上有关于usb_modeswitch的部分,你是按照什么说明做的?
"If you have an apple and I have an apple and we exchange apples, then you and I will
still each have one apple. But if you have an idea and I have an idea and we exchange
these ideas, then each of us will have two ideas."
级别: 侠客
UID: 4545
精华: 3
发帖: 88
金钱: 810 两
威望: 614 点
综合积分: 236 分
注册时间: 2009-03-19
最后登录: 2020-06-17
3楼  发表于: 2009-08-20 15:01
缺少libusb
交叉编译附件里的源码
刚测了一下 有了libusb库后,
usb_modeswitch 就能成功编译了
附件: libusb-0.1.12.tar.gz (381 K) 下载次数:106
级别: 新手上路
UID: 7382
精华: 0
发帖: 18
金钱: 180 两
威望: 115 点
综合积分: 36 分
注册时间: 2009-07-13
最后登录: 2010-03-12
4楼  发表于: 2009-08-20 15:07
可能我说的不太明白,usb_modeswitch.c中文件包含如下
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
//#include <locale.h>
#include <assert.h>
#include <signal.h>
#include <ctype.h>
#include <getopt.h>
#include <usb.h>这里
#include "usb_modeswitch.h"

我其实是不知道usb.h要去哪里找,为什么编译器说找不到,最后我应该怎么做,usb_modeswitch在pc下能编译,但是不能交叉编译
级别: 新手上路
UID: 7382
精华: 0
发帖: 18
金钱: 180 两
威望: 115 点
综合积分: 36 分
注册时间: 2009-07-13
最后登录: 2010-03-12
5楼  发表于: 2009-08-20 15:11

 回 3楼(长风) 的帖子

好帅,谢谢了,试下先
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
6楼  发表于: 2009-08-20 15:20

 Re:回 3楼(长风) 的帖子

引用第5楼yyh572103于2009-08-20 15:11发表的 回 3楼(长风) 的帖子 :
好帅,谢谢了,试下先

别忘了把编译好的libusb也放到开发板上去,不然你又该问为什么跑起来说找不到文件了
"If you have an apple and I have an apple and we exchange apples, then you and I will
still each have one apple. But if you have an idea and I have an idea and we exchange
these ideas, then each of us will have two ideas."
级别: 新手上路
UID: 7382
精华: 0
发帖: 18
金钱: 180 两
威望: 115 点
综合积分: 36 分
注册时间: 2009-07-13
最后登录: 2010-03-12
7楼  发表于: 2009-08-20 15:49
引用第3楼长风于2009-08-20 15:01发表的 :
缺少libusb
交叉编译附件里的源码
刚测了一下 有了libusb库后,
usb_modeswitch 就能成功编译了


能否说的详细点,不是很懂,交叉编译libusb要指定安装路径什么的吗?
级别: 新手上路
UID: 7382
精华: 0
发帖: 18
金钱: 180 两
威望: 115 点
综合积分: 36 分
注册时间: 2009-07-13
最后登录: 2010-03-12
8楼  发表于: 2009-08-20 16:02
级别: 新手上路
UID: 7382
精华: 0
发帖: 18
金钱: 180 两
威望: 115 点
综合积分: 36 分
注册时间: 2009-07-13
最后登录: 2010-03-12
9楼  发表于: 2009-08-21 14:12
引用第3楼长风于2009-08-20 15:01发表的 :
缺少libusb
交叉编译附件里的源码
刚测了一下 有了libusb库后,
usb_modeswitch 就能成功编译了


交叉编译了libusb,安装在/home/libusb_arm目录下, /home/libusb-arm/usr/local/include/usb.h 是存在的,可是
我用arm-linux-gcc -l /home/libusb-arm/usr/local/include/usb.h -o usb_modeswitch usb_modeswitch.c还是找不到usb.h,新手太菜,实在是……

交叉编译usb_modeswitch过程如下:
[root@localhost usb_modeswitch-1.0.2]# arm-linux-gcc -l /home/libusb-arm/usr/local/include/usb.h -o usb_modeswitch usb_modeswitch.cusb_modeswitch.c:61:17: error: usb.h: No such file or directory
usb_modeswitch.c: In function 'main':
usb_modeswitch.c:358: error: dereferencing pointer to incomplete type
usb_modeswitch.c:358: error: dereferencing pointer to incomplete type
usb_modeswitch.c:360: warning: assignment makes pointer from integer without a cast
usb_modeswitch.c:367: error: dereferencing pointer to incomplete type
usb_modeswitch.c:369: error: dereferencing pointer to incomplete type
usb_modeswitch.c: In function 'deviceDescription':
usb_modeswitch.c:493: error: dereferencing pointer to incomplete type
usb_modeswitch.c:494: error: dereferencing pointer to incomplete type
usb_modeswitch.c:503: error: dereferencing pointer to incomplete type
usb_modeswitch.c:504: error: dereferencing pointer to incomplete type
usb_modeswitch.c:513: error: dereferencing pointer to incomplete type
usb_modeswitch.c:514: error: dereferencing pointer to incomplete type
usb_modeswitch.c: In function 'switchHuaweiMode':
usb_modeswitch.c:697: error: 'USB_TYPE_STANDARD' undeclared (first use in this function)
usb_modeswitch.c:697: error: (Each undeclared identifier is reported only once
usb_modeswitch.c:697: error: for each function it appears in.)
usb_modeswitch.c:697: error: 'USB_RECIP_DEVICE' undeclared (first use in this function)
usb_modeswitch.c:697: error: 'USB_REQ_SET_FEATURE' undeclared (first use in this function)
usb_modeswitch.c: In function 'switchSonyMode':
usb_modeswitch.c:758: warning: assignment makes pointer from integer without a cast
usb_modeswitch.c: In function 'checkSuccess':
usb_modeswitch.c:832: warning: assignment makes pointer from integer without a cast
usb_modeswitch.c: In function 'search_devices':
usb_modeswitch.c:910: warning: assignment makes pointer from integer without a cast
usb_modeswitch.c:910: error: dereferencing pointer to incomplete type
usb_modeswitch.c:912: error: dereferencing pointer to incomplete type
usb_modeswitch.c:912: error: dereferencing pointer to incomplete type
usb_modeswitch.c:913: error: dereferencing pointer to incomplete type
usb_modeswitch.c:913: error: dereferencing pointer to incomplete type
usb_modeswitch.c:915: error: dereferencing pointer to incomplete type
usb_modeswitch.c:917: error: dereferencing pointer to incomplete type
usb_modeswitch.c: In function 'find_first_bulk_output_endpoint':
usb_modeswitch.c:934: error: dereferencing pointer to incomplete type
usb_modeswitch.c:937: error: dereferencing pointer to incomplete type
usb_modeswitch.c:938: error: dereferencing pointer to incomplete type
usb_modeswitch.c:939: error: dereferencing pointer to incomplete type
usb_modeswitch.c:939: error: 'USB_ENDPOINT_TYPE_MASK' undeclared (first use in this function)
usb_modeswitch.c:939: error: 'USB_ENDPOINT_TYPE_BULK' undeclared (first use in this function)
usb_modeswitch.c:940: error: dereferencing pointer to incomplete type
usb_modeswitch.c:940: error: 'USB_ENDPOINT_DIR_MASK' undeclared (first use in this function)
usb_modeswitch.c:941: error: dereferencing pointer to incomplete type
usb_modeswitch.c: In function 'find_first_bulk_input_endpoint':
usb_modeswitch.c:951: error: dereferencing pointer to incomplete type
usb_modeswitch.c:954: error: dereferencing pointer to incomplete type
usb_modeswitch.c:955: error: dereferencing pointer to incomplete type
usb_modeswitch.c:956: error: dereferencing pointer to incomplete type
usb_modeswitch.c:956: error: 'USB_ENDPOINT_TYPE_MASK' undeclared (first use in this function)
usb_modeswitch.c:956: error: 'USB_ENDPOINT_TYPE_BULK' undeclared (first use in this function)
usb_modeswitch.c:957: error: dereferencing pointer to incomplete type
usb_modeswitch.c:957: error: 'USB_ENDPOINT_DIR_MASK' undeclared (first use in this function)
usb_modeswitch.c:958: error: dereferencing pointer to incomplete type
  • «
  • 1
  • 2
  • »
  • Pages: 1/2     Go