Add also

extern "C" {
#include <kernel/stuff.h>
// ...
}

Kernel headers are not design for C++.  (But usable anyway).

Richard

>From:  [EMAIL PROTECTED][SMTP:[EMAIL PROTECTED]]
>
>Hello,
>
>Our group tried rt-linux recently, and can not get our C++ program works.
>The problem is when we tried to insmod the object code, it gave all
>rt function calls (rt_task_init, rt_task_wait, ...) as unresolved symbols.
>
>The code is really simple, doing nothing except printk("Hello\n"). We add
>-D__KERNEL__ and -D__RT__ options when using g++
>
>Can anyone tell me what's wrong with it and how to fix it? Or g++ is
>totally not usable for rt-linux?
>
>Thanks.
>
>Shige Wang
>RTCL
>EECS
>UM
>-----------------------------------
>PS. Here are the code, our compile command and error message:
>
>#define MODULE
>
>#include <linux/types.h>
>#include <linux/module.h>
>#include <linux/rt_sched.h>
>#include <linux/kernel.h>
>#include <linux/version.h>
>
>RT_TASK task[1];
>
>void getMem(int task)
>{
>
>  while (1) {
>       printk("Hello\n");
>  }
>  
>  rt_task_wait();
>  }
>}
>
>int init_module(void) 
>{
>   printk("Start it...\n");
>
>   rt_task_init(&task[0], getMem, 1, 100000, 1);
>   rt_task_make_periodic(&task[0], rt_get_time(), \
>       (RTIME)(RT_TICKS_PER_SEC/10000 ));
>
>   return 0;
>}
>
>void cleanup_module(void)
>{
>   rt_task_delete(&task[0]);
>}
>
>[ercrms33]#g++ -g -c memalloc.cpp -D__KERNEL__ -D__RT__
>
>[ercrms33]#/sbin/insmod memalloc.o  
>
>memalloc.o: unresolved symbol rt_task_init__FP14rt_task_structPFi_viii
>memalloc.o: unresolved symbol rt_task_wait__Fv
>memalloc.o: unresolved symbol rt_get_time__Fv
>memalloc.o: unresolved symbol rt_task_delete__FP14rt_task_struct
>memalloc.o: unresolved symbol rt_task_make_periodic__FP14rt_task_structxx
> 
>
>--- [rtl] ---
>To unsubscribe:
>echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
>echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
>----
>For more information on Real-Time Linux see:
>http://www.rtlinux.org/~rtlinux/
>
--- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
----
For more information on Real-Time Linux see:
http://www.rtlinux.org/~rtlinux/

Reply via email to