LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-01-2004, 09:54 PM   #1
prix
LQ Newbie
 
Registered: Oct 2004
Posts: 1

Rep: Reputation: 0
Question Linux Timers add_timer init_timer compilation problem


Hi ,

Has anyone used Linux timers system calls add_timer??
I need to use multiple timers in my program.

I am compiling this sample program but getting problems.
Could anyone help me out with resolving the issue ??

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <asm/param.h>
#include <linux/timer.h>
void showint(unsigned long i)
{
printf("%c",'.');
}

int main(void)
{
struct timer_list *tl = (struct timer_list*)malloc(sizeof(struct
timer_list));
init_timer(tl);
tl->expires = 100;
tl->function = showint;
add_timer(tl);
return 0;
}

Its basically a sample i got from some site.which i am trying to compile

I am using the following commands
gcc timer.c
and i am getting the errors
/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:42: conflicting types for `typedef struct
timer_list timer_t'
/usr/include/time.h:94: previous declaration as `typedef __timer_t
timer_t'
/usr/include/linux/timer.h:63: field `list' has incomplete type
/usr/include/linux/timer.h: In function `void init_timer (timer_list
*)':
/usr/include/linux/timer.h:105: `struct timer_list' has no member named
`list'
/usr/include/linux/timer.h:105: `struct timer_list' has no member named
`list'
/usr/include/linux/timer.h: In function `int timer_pending (const
timer_list *)':
/usr/include/linux/timer.h:121: `struct timer_list' has no member named
`list'


If i compile using gcc timer.c -D__KERNEL__ -DLINUX -DMODULE -Wall -O -I/usr/include
then i get
/usr/include/linux/timer.h:42: conflicting types for `timer_t'
/usr/include/time.h:94: previous declaration of `timer_t'
kerenel is 2.4.9-34

Last edited by prix; 11-02-2004 at 02:11 AM.
 
Old 12-05-2005, 07:08 AM   #2
santhosh.linux
Member
 
Registered: Nov 2005
Location: India
Posts: 42

Rep: Reputation: 15
me to getting same problem ,have u found any solution for it,
please reply , i am hurry with my project
santhosh.linux@gmail.com
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Mplayer compilation problem on linux 2.6.3 gcc 3.3.3 glibc 2.3.2 realloc Linux - Software 4 10-22-2004 03:44 PM
Linux kernel compilation problem ... Neo_the_one Linux - Software 2 09-30-2004 10:17 AM
Compilation error when including <linux/ext3_fs.h> in SuSE Linux 9.0 (i586) seshasai Linux - Distributions 0 06-01-2004 03:22 AM
Help with add_timer samble Programming 1 02-13-2004 11:43 AM
Compilation problem... need help Korshun Programming 2 05-07-2002 12:33 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:50 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration