LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-12-2013, 06:20 PM   #1
wieczoj
LQ Newbie
 
Registered: Jul 2013
Posts: 2

Rep: Reputation: Disabled
Timer_create


Hi,

I've tried to compile the example program from timer_create man page and it failed. Could anyone help me?

Konrad
Attached Files
File Type: txt timer_create.txt (3.3 KB, 84 views)

Last edited by wieczoj; 07-12-2013 at 06:43 PM.
 
Old 07-12-2013, 06:22 PM   #2
Kustom42
Senior Member
 
Registered: Mar 2012
Distribution: Red Hat
Posts: 1,604

Rep: Reputation: 414Reputation: 414Reputation: 414Reputation: 414Reputation: 414
Can you provide more detail on teh code you are trying to compile. Place it inside teh code tags on your post will be a big help. I looked at the man page i have installed for timer_create and got good info on what it is but there were no example scripts listed.
 
Old 07-13-2013, 05:02 AM   #3
kooru
Senior Member
 
Registered: Sep 2012
Posts: 1,385

Rep: Reputation: 273Reputation: 273Reputation: 273
Hi and welcome to LQ!
You didn't post the error but i suppose that you used gcc without "rt" library.

Try this:

Code:
gcc -lrt time_create.c
It should work.
 
1 members found this post helpful.
Old 07-13-2013, 05:32 AM   #4
wieczoj
LQ Newbie
 
Registered: Jul 2013
Posts: 2

Original Poster
Rep: Reputation: Disabled
gcc -c timer_create.c
echo $?
0
gcc -lrt timer_create.c
/tmp/ccF6L5We.o: In function `print_siginfo':
timer_create.c.text+0x5f): undefined reference to `timer_getoverrun'
/tmp/ccF6L5We.o: In function `main':
timer_create.c.text+0x245): undefined reference to `timer_create'
timer_create.c.text+0x326): undefined reference to `timer_settime'
collect2: ld returned 1 exit status
 
Old 07-13-2013, 06:49 AM   #5
kooru
Senior Member
 
Registered: Sep 2012
Posts: 1,385

Rep: Reputation: 273Reputation: 273Reputation: 273
Works for me:

Code:
$> gcc timer_create.c 
/tmp/ccY0iuGU.o: In function `print_siginfo':
timer_create.c:(.text+0x43): undefined reference to `timer_getoverrun'
/tmp/ccY0iuGU.o: In function `main':
timer_create.c:(.text+0x21e): undefined reference to `timer_create'
timer_create.c:(.text+0x318): undefined reference to `timer_settime'
collect2: error: ld returned 1 exit status

$> gcc -lrt timer_create.c 
$> ./a.out    
Usage: ./a.out <sleep-secs> <freq-nanosecs>

$> ./a.out 4 1
Establishing handler for signal 34
Blocking signal 34
timer ID is 0x9a10008
Sleeping for 4 seconds
Unblocking signal 34
Caught signal 34
    sival_ptr = 0xbfe27734;     *sival_ptr = 0x9a10008
    overrun count = -294661441
$>
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
How to resolve EAGAIN (errno 11) from timer_create? codeblazer Linux - Newbie 0 07-03-2012 07:08 PM
C timer_create skeleton newbie14 Programming 10 01-10-2012 12:09 AM
timer_create failing manohar Programming 3 06-21-2011 01:18 PM
[C/C++] Using timer_create() and interrupting sleep() dwhitney67 Programming 0 05-19-2009 08:30 AM
Timer Deadlock problem in timer_create and delete_timer nkk4u Programming 0 04-15-2005 03:10 AM


All times are GMT -5. The time now is 10:40 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration