Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7060735
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T04:23:18+00:00 2026-05-28T04:23:18+00:00

I started studying POSIX timers, so I started also doing some exercises, but I

  • 0

I started studying POSIX timers, so I started also doing some exercises, but I immediately had some problems with the compiler.
When compiling this code, I get some strange messages about macros like CLOCK_MONOTONIC. Those are defined in various libraries like time.h etc. but the compiler gives me errors as if they are not defined.

It is strange because I am using a Fedora 16, and some of my friends with Ubuntu get less compiler errors than I :-O

I am compiling with gcc -O0 -g3 -Wall -c -fmessage-length=0 -std=c99 -lrt

Here the errors I get:

  • struct sigevent sigeventStruct gives:

    storage size of ‘sigeventStruct’ isn’t known
    unused variable ‘sigeventStruct’ [-Wunused-variable]
    Type 'sigevent' could not be resolved
    unknown type name ‘sigevent’
    
  • sigeventStruct.sigev_notify = SIGEV_SIGNAL gives:

    ‘SIGEV_SIGNAL’ undeclared (first use in this function)
    request for member ‘sigev_notify’ in something not a structure or union
    Field 'sigev_notify' could not be resolved
    
  • if(timer_create(CLOCK_MONOTONIC, sigeventStruct, numero1) == -1) gives:

    implicit declaration of function ‘timer_create’ [-Wimplicit-function- declaration]
    ‘CLOCK_MONOTONIC’ undeclared (first use in this function)
    Symbol 'CLOCK_MONOTONIC' could not be resolved
    

Here is the code:

#include <stdio.h>
#include <fcntl.h>
#include <time.h>
#include <stdlib.h>
#include <errno.h>
#include <unistd.h>
#include <signal.h>

int main()
{
        timer_t numero1;
        struct sigevent sigeventStruct;
        sigeventStruct.sigev_notify = SIGEV_SIGNAL;
        if(timer_create(CLOCK_MONOTONIC, sigeventStruct, numero1) == -1)
        {
                printf( "Errore: %s\n", strerror( errno ) );
        }
        return 0;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T04:23:18+00:00Added an answer on May 28, 2026 at 4:23 am

    Firstly, you can compile your code with -std=gnu99 instead of -std=c99 if you want to have the identifiers SIGEV_SIGNAL, sigeventStruct, and CLOCK_MONOTONIC available.

    As noted by @adwoodland these identifiers are declared when _POSIX_C_SOURCE is set to a value >= 199309L, which is the case with -std=gnu99. You can also use -D_POSIX_C_SOURCE=199309L -std=c99 or have the macro defined in source code.

    Secondly, see the timer_create prototype, you have to pass pointers as the second and the third argument to the function:

    timer_create(CLOCK_MONOTONIC, &sigeventStruct, &numero1)
                                  ^                ^
    

    Also you have to include the standard header string.h for strerror function declaration.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Sorry if this question is too simple or easy. I just started studying Delegates
I have recently started studying Google Web Toolkit. I have went through some walkthroughs,
I'm studying querulous and started with this code: import com.twitter.querulous.evaluator.QueryEvaluator class Querulous { def
I recently started studying JSP and Servlets. I am facing problems forwarding the dataList
I have just started studying Android, I have limited java knowledge but am semi
I have just started self-studying the Dragon book of Compiler Design. I am working
Maybe some might find this, a hypothetical question. I have recently started development of
I just started studying C++, and I met this new guy: ->. I was
I just started studying Python two days ago, so my code is sloppy...But I'm
Sorry if this question was asked already. I started studying C# and noticed that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.