2014年(33)
分类: LINUX
2014-08-19 17:17:01
编译.ko驱动模块过程报如下错误:
$ make
信息1:
ARCH=arm CROSS_COMPILE=/opt/freescale/usr/local/gcc-4.4.4-glibc-2.11.1-multilib-1.0/arm-fsl-linux-gnueabi/bin/arm-fsl-linux-gnueabi- make -C /home/thy/ltib/rpm/BUILD/linux M=/mnt/hgfs/share/work/fs_lradc modules
make[1]: Entering directory `/home/thy/ltib/rpm/BUILD/linux-2.6.35.3'
CC [M] /mnt/hgfs/share/work/fs_lradc/fs_lradc.o
/mnt/hgfs/share/work/fs_lradc/fs_lradc.c: In function 'lradc0_read':
/mnt/hgfs/share/work/fs_lradc/fs_lradc.c:136: error: implicit declaration of function 'copy_to_user'
make[2]: *** [/mnt/hgfs/share/work/fs_lradc/fs_lradc.o] Error 1
make[1]: *** [_module_/mnt/hgfs/share/work/fs_lradc] Error 2
make[1]: Leaving directory `/home/thy/ltib/rpm/BUILD/linux-2.6.35.3'
make: *** [modules] Error 2
信息2:
cpld_lcmxo2-2000hc.c:125: error: implicit declaration of function 'MKDEV'
cpld_lcmxo2-2000hc.c:128: error: implicit declaration of function 'register_chrdev_region'
cpld_lcmxo2-2000hc.c:135: error: implicit declaration of function 'alloc_chrdev_region'
cpld_lcmxo2-2000hc.c:141: error: implicit declaration of function 'unregister_chrdev_region'
解决办法:
添加
#include
#include
#include
出现类似于“implicit declaration of function ***”这种错误,多半是由于没有正确添加头文件造成的。