当前位置: 技术问答>linux和unix
包含<asm/semaphore.h>后编译通不过???
来源: 互联网 发布时间:2016-01-20
本文导语: 我在程序中包含了<asm/semaphore.h>后运行 gcc -c -D__KERNEL__ -I/usr/src/linux/include pc.c编译出错: /usr/src/linux/include/asm/rwsem.h: 在函数 ‘__down_read’ 中: /usr/src/linux/include/asm/rwsem.h:106: 错误:expected ‘:’ or ‘)’ befo...
我在程序中包含了<asm/semaphore.h>后运行 gcc -c -D__KERNEL__ -I/usr/src/linux/include pc.c编译出错:
/usr/src/linux/include/asm/rwsem.h: 在函数 ‘__down_read’ 中:
/usr/src/linux/include/asm/rwsem.h:106: 错误:expected ‘:’ or ‘)’ before ‘KBUILD_BASENAME’/usr/src/linux/include/asm/rwsem.h: 在函数 ‘__down_write’ 中:
/usr/src/linux/include/asm/rwsem.h:158: 错误:expected ‘:’ or ‘)’ before ‘KBUILD_BASENAME’/usr/src/linux/include/asm/rwsem.h: 在函数 ‘__up_read’ 中:
/usr/src/linux/include/asm/rwsem.h:195: 错误:expected ‘:’ or ‘)’ before ‘KBUILD_BASENAME’/usr/src/linux/include/asm/rwsem.h: 在函数 ‘__up_write’ 中:
/usr/src/linux/include/asm/rwsem.h:221: 错误:expected ‘:’ or ‘)’ before ‘KBUILD_BASENAME’/usr/src/linux/include/asm/rwsem.h: 在函数 ‘__downgrade_write’ 中:
/usr/src/linux/include/asm/rwsem.h:246: 错误:expected ‘:’ or ‘)’ before ‘KBUILD_BASENAME’In file included from pc.c:7:
/usr/src/linux/include/asm/semaphore.h: 在函数 ‘down’ 中:
/usr/src/linux/include/asm/semaphore.h:105: 错误:expected ‘:’ or ‘)’ before ‘KBUILD_BASENAME’/usr/src/linux/include/asm/semaphore.h: 在函数 ‘down_interruptible’ 中:
/usr/src/linux/include/asm/semaphore.h:130: 错误:expected ‘:’ or ‘)’ before ‘KBUILD_BASENAME’/usr/src/linux/include/asm/semaphore.h: 在函数 ‘down_trylock’ 中:
/usr/src/linux/include/asm/semaphore.h:155: 错误:expected ‘:’ or ‘)’ before ‘KBUILD_BASENAME’/usr/src/linux/include/asm/semaphore.h: 在函数 ‘up’ 中:
/usr/src/linux/include/asm/semaphore.h:179: 错误:expected ‘:’ or ‘)’ before
请问是为什么?是否gcc还需加什么参数?还是要在编译内核时增加什么选项??
/usr/src/linux/include/asm/rwsem.h: 在函数 ‘__down_read’ 中:
/usr/src/linux/include/asm/rwsem.h:106: 错误:expected ‘:’ or ‘)’ before ‘KBUILD_BASENAME’/usr/src/linux/include/asm/rwsem.h: 在函数 ‘__down_write’ 中:
/usr/src/linux/include/asm/rwsem.h:158: 错误:expected ‘:’ or ‘)’ before ‘KBUILD_BASENAME’/usr/src/linux/include/asm/rwsem.h: 在函数 ‘__up_read’ 中:
/usr/src/linux/include/asm/rwsem.h:195: 错误:expected ‘:’ or ‘)’ before ‘KBUILD_BASENAME’/usr/src/linux/include/asm/rwsem.h: 在函数 ‘__up_write’ 中:
/usr/src/linux/include/asm/rwsem.h:221: 错误:expected ‘:’ or ‘)’ before ‘KBUILD_BASENAME’/usr/src/linux/include/asm/rwsem.h: 在函数 ‘__downgrade_write’ 中:
/usr/src/linux/include/asm/rwsem.h:246: 错误:expected ‘:’ or ‘)’ before ‘KBUILD_BASENAME’In file included from pc.c:7:
/usr/src/linux/include/asm/semaphore.h: 在函数 ‘down’ 中:
/usr/src/linux/include/asm/semaphore.h:105: 错误:expected ‘:’ or ‘)’ before ‘KBUILD_BASENAME’/usr/src/linux/include/asm/semaphore.h: 在函数 ‘down_interruptible’ 中:
/usr/src/linux/include/asm/semaphore.h:130: 错误:expected ‘:’ or ‘)’ before ‘KBUILD_BASENAME’/usr/src/linux/include/asm/semaphore.h: 在函数 ‘down_trylock’ 中:
/usr/src/linux/include/asm/semaphore.h:155: 错误:expected ‘:’ or ‘)’ before ‘KBUILD_BASENAME’/usr/src/linux/include/asm/semaphore.h: 在函数 ‘up’ 中:
/usr/src/linux/include/asm/semaphore.h:179: 错误:expected ‘:’ or ‘)’ before
请问是为什么?是否gcc还需加什么参数?还是要在编译内核时增加什么选项??
|
你在编译内核么?
那么就是头文件的位置,你取得不对
那么就是头文件的位置,你取得不对
|
include中指定目录,看看还有没有错误