【问题标题】:Compile kernel driver failed when processing __user处理 __user 时编译内核驱动程序失败
【发布时间】:2014-01-18 14:20:59
【问题描述】:

编译内核驱动程序时出现编译错误。错误信息是

pxa270_gpio_led_drv.c|27 col 70| error: expected ‘;’, ‘,’ or ‘)’ before ‘*’ token
||  static ssize_t SIMPLE_GPIO_LED_read ( struct file *file, char __user *buf, size_t count, loff_t *offset)

部分源文件为:

static ssize_t SIMPLE_GPIO_LED_read ( struct file *file, char __user *buf, size_t count, loff_t *offset) 
{
#ifdef OURS_GPIO_LED_DEBUG 
printk ("SIMPLE_GPIO_LED_read [ --kernel--]\n"); 
#endif 
return count; 
}

编译命令为:

 gcc -c -Wall -O -D__KERNEL__ -DMODULE -I/home/test/Desktop/linux-2.4.21/include   pxa270_gpio_led_drv.c -o pxa270_gpio_led_drv.o

谁能帮帮我?谢谢。

【问题讨论】:

  • 您似乎缺少一个包含。定义__user的那个,按照错误消息中的列号。
  • 为什么你认为这个驱动可以编译成2.4内核?
  • 我需要多学习!

标签: compiler-errors linux-kernel driver


【解决方案1】:

您是否包含了定义loff_t<linux/types.h>

__user 宏是对 gcc 的指令,不需要包含标头。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-05-23
    • 1970-01-01
    • 2021-09-26
    • 1970-01-01
    • 2017-05-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多