dimanche 11 mai 2014

Erreurs du compilateur - compilation du noyau conducteur a échoué lors du traitement __user - Stack Overflow


I get a compile error when compiling a kernel driver.The error info is


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)

Part of the source file is:


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;
}

The compile command is :


 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

Can anyone help me? Thanks.




Have you included <linux/types.h> that defines loff_t ?


The __user macro is an instruction to gcc and doesn't require inclusion of a header.



I get a compile error when compiling a kernel driver.The error info is


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)

Part of the source file is:


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;
}

The compile command is :


 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

Can anyone help me? Thanks.



Have you included <linux/types.h> that defines loff_t ?


The __user macro is an instruction to gcc and doesn't require inclusion of a header.


0 commentaires:

Enregistrer un commentaire