免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1653 | 回复: 1
打印 上一主题 下一主题

请问以下代码有何问题?编译一直出错。 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-06-12 21:09 |只看该作者 |倒序浏览
kernel:         2.6.20-16
linux version:  ubuntu 7.04

include <stdlib.h>

#include <stdio.h>

#include <sys/ioctl.h>

#include <sys/types.h>

#include <sys/stat.h>

#include <asm/types.h>

#include <fcntl.h>

#include <unistd.h>

#include <linux/hiddev.h>



#define DEBUG 1

#define HID_MAX_MULTI_USAGES 1024

#define HIDIOCGUSAGES _IOWR('H', 0x13, struct hiddev_usage_ref_multi)

#define HIDIOCSUSAGES _IOW('H', 0x14, struct hiddev_usage_ref_multi)



#define HID_MAX_MULTI_USAGES 1024



struct hiddev_usage_ref_multi{

        struct hiddev_usage_ref uref;

        __u32 num_values;

        __s32 values[HID_MAX_MULTI_USAGES];

};



int main (int argc, char **argv)

{

struct hiddev_report_info rinfo;

struct hiddev_usage_ref uref;

struct hiddev_field_info finfo;

struct hiddev_usage_ref_multi urefs;



unsigned char byLgtOn[] = {0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};

unsigned char byLgtOff[] = {0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};



printf("test\n");

}


gcc file.c

出错误提示如下:
file.c:20: 错误: ‘struct hiddev_usage_ref_multi’ 重定义
/usr/include/linux/hiddev.h:132: 错误: ‘struct hiddev_usage_ref_multi’ 的上一个定义

论坛徽章:
0
2 [报告]
发表于 2008-06-12 21:24 |只看该作者

回复 #1 nuage 的帖子

老大,已经说了struct hiddev_usage_ref_multi’ 重定义

是在<linux/hiddev.h>中定义的,

要么删除

struct hiddev_usage_ref_multi{

        struct hiddev_usage_ref uref;

        __u32 num_values;

        __s32 values[HID_MAX_MULTI_USAGES];

};

要么改个名字,比如struct my_hiddev_usage_ref_multi{

        struct hiddev_usage_ref uref;

        __u32 num_values;

        __s32 values[HID_MAX_MULTI_USAGES];

};
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP