while compiling c programme it's showing errors in header files
hi all
I am new to linux , I have just written a c programme to get pid of a current process. in that i have included the header file <linux/sched.h> But while compiling in red hat linux 9.0 (2.40.8 ) i have got errors in the code of header files. the errors were as follows can any one help me in this regard. error messages ************************************** [root@localhost mcc]# cc t1.c In file included from /usr/include/linux/sched.h:13, from t1.c:3: /usr/include/linux/times.h:5: parse error before "clock_t" /usr/include/linux/times.h:7: parse error before "tms_cutime" /usr/include/linux/times.h:8: parse error before "tms_cstime" In file included from /usr/include/linux/sched.h:14, from t1.c:3: /usr/include/linux/timex.h:173: field `time' has incomplete type In file included from /usr/include/linux/bitops.h:69, from /usr/include/asm/system.h:7, from /usr/include/linux/sched.h:16, from t1.c:3: /usr/include/asm/bitops.h:327:2: warning: #warning This includefile is not available on all architectures. /usr/include/asm/bitops.h:328:2: warning: #warning Using kernel headers in userspace: atomicity not guaranteed In file included from /usr/include/linux/signal.h:4, from /usr/include/linux/sched.h:25, from t1.c:3: /usr/include/asm/signal.h:107: parse error before "sigset_t" /usr/include/asm/signal.h:110: parse error before '}' token In file included from /usr/include/linux/signal.h:5, from /usr/include/linux/sched.h:25, from t1.c:3: /usr/include/asm/siginfo.h:26: parse error before "pid_t" /usr/include/asm/siginfo.h:38: parse error before "pid_t" /usr/include/asm/siginfo.h:41: parse error before '}' token /usr/include/asm/siginfo.h:45: parse error before "pid_t" /usr/include/asm/siginfo.h:48: parse error before "_utime" /usr/include/asm/siginfo.h:49: parse error before "_stime" /usr/include/asm/siginfo.h:62: parse error before '}' token /usr/include/asm/siginfo.h:63: parse error before '}' token In file included from /usr/include/linux/sched.h:78, from t1.c:3: /usr/include/linux/time.h:10: parse error before "time_t" /usr/include/linux/time.h:12: parse error before '}' token /usr/include/linux/time.h:18: parse error before "time_t" /usr/include/linux/time.h:44: field `it_interval' has incomplete type /usr/include/linux/time.h:45: field `it_value' has incomplete type /usr/include/linux/time.h:49: field `it_interval' has incomplete type /usr/include/linux/time.h:50: field `it_value' has incomplete type In file included from /usr/include/linux/sched.h:80, from t1.c:3: /usr/include/linux/resource.h:22: field `ru_utime' has incomplete type /usr/include/linux/resource.h:23: field `ru_stime' has incomplete type In file included from /usr/include/linux/sched.h:81, from t1.c:3: /usr/include/linux/timer.h:32: field `vec' has incomplete type /usr/include/linux/timer.h:37: field `vec' has incomplete type /usr/include/linux/timer.h:45: parse error before "spinlock_t" /usr/include/linux/timer.h:53: parse error before '}' token /usr/include/linux/timer.h:63: field `list' has incomplete type /usr/include/linux/timer.h:67: parse error before "tvec_base_t" /usr/include/linux/timer.h:101: parse error before "tvec_bases" /usr/include/linux/timer.h: In function `init_timer': /usr/include/linux/timer.h:105: dereferencing pointer to incomplete type /usr/include/linux/timer.h:105: dereferencing pointer to incomplete type /usr/include/linux/timer.h:106: dereferencing pointer to incomplete type /usr/include/linux/timer.h: In function `timer_pending': /usr/include/linux/timer.h:121: dereferencing pointer to incomplete type |
Can you tell me why you use root for compiling?! It's like you want bad things to happen ;)
Never use the name of root in vain! Please post the contents of t1.c . |
All times are GMT -5. The time now is 05:15 AM. |