LinuxQuestions.org
Review your favorite Linux distribution.
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 10-25-2006, 11:24 PM   #1
arabindav
LQ Newbie
 
Registered: Oct 2006
Posts: 9

Rep: Reputation: 0
Question Linux timers


Hello,

I need to use four timers in my application. I am using Redhat Linux 9.0.

I came across functions like timer_create(), timer_delete()... But when I tried to call these function from my application there was linking error.

/tmp/cc0r6EtC.o(.text+0x3e): In function `main':
: undefined reference to `timer_create'

I have included following header files:

#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <signal.h>
#include <unistd.h>
#include <sys/types.h>
#include <error.h>
#include <sys/syscall.h>

Here are my questions.

1. Am I taking the correct direction? I mean using timer_create() and other related functions.

2. Am I missing any specific header file? Do I have to link to some library? Or simply the source code for the function is missing?

3. If the source is missing, where I can find it.

4. It would be great if you could direct me to some tutorials or something that is helpful in this regard.

5. I do not think setitimer() and getitime() going to help me. I have to have different timer values for all the timers and on expiration I need to call different functions. Any thoughts?

Your help is highly appreciated.

Regards.
 
Old 10-26-2006, 12:47 AM   #2
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 374Reputation: 374Reputation: 374Reputation: 374
You need to link against the real-time library. Add -lrt to your gcc command.
 
Old 10-26-2006, 01:52 AM   #3
arabindav
LQ Newbie
 
Registered: Oct 2006
Posts: 9

Original Poster
Rep: Reputation: 0
Thanks Dark_Helmet, its working!
 
  


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
Linux timers arabindav Linux - General 3 05-20-2011 07:33 AM
C - Linux - Timers - How? drigz Programming 6 08-30-2004 02:36 PM
Pls Help, Singals and Timers problem in RedHat Linux 7.3 kumarnine Programming 2 08-26-2004 09:16 AM
timers is user space in linux gooner Programming 0 06-07-2004 03:52 AM
Help with Linux timers samble Programming 8 02-07-2004 10:54 PM

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

All times are GMT -5. The time now is 07:46 PM.

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