Welcome to the Linux Foundation Forum!

atomic.h issue in Ubuntu 9.4

I can't compile atomic.h in Ubuntu 9.4, below is source code:

#include

#include

#include

int main(void) {

puts("!!!Hello World!!!");

return EXIT_SUCCESS;

}

the following is the error info:

/usr/src/linux-headers-2.6.28-11/arch/x86/include/asm/alternative.h:45: 错误: expected specifier-qualifier-list before ‘u8'

Can anyone help me?

Comments

  • after using __KERNEL__, 'u8' can be found, but it occurred other errors:

    gcc -DCONFIG_X86_32 -D__KERNEL__ -I/usr/src/linux-headers-2.6.28-11/include -I/usr/src/linux-headers-2.6.28-11/arch/x86/include -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/test_atomic.d" -MT"src/test_atomic.d" -o"src/test_atomic.o" "../src/test_atomic.c"

    /usr/src/linux-headers-2.6.28-11/include/linux/log2.h:52: 错误: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘is_power_of_2’
    In file included from /usr/src/linux-headers-2.6.28-11/arch/x86/include/asm/system.h:10,
    from /usr/src/linux-headers-2.6.28-11/arch/x86/include/asm/processor.h:17,
    from /usr/src/linux-headers-2.6.28-11/arch/x86/include/asm/atomic_32.h:5,
    from /usr/src/linux-headers-2.6.28-11/arch/x86/include/asm/atomic.h:2,
    from ../src/test_atomic.c:14:
    /usr/src/linux-headers-2.6.28-11/include/linux/kernel.h:236: 错误: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘printk_timed_ratelimit’
    /usr/src/linux-headers-2.6.28-11/include/linux/kernel.h:303: 错误: expected declaration specifiers or ‘...’ before ‘bool’
    /usr/src/linux-headers-2.6.28-11/include/linux
  • Posts: 501
    Kernel code has no main() function. Please do some reading on kernel module development before you try to mung your system...

Welcome!

It looks like you're new here. Sign in or register to get started.
Sign In

Welcome!

It looks like you're new here. Sign in or register to get started.
Sign In

Categories

Upcoming Training