Constants not loaded by compiler

后端 未结 5 1297
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-04 19:49

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

5条回答
  •  臣服心动
    2021-01-04 20:29

    If you are using -std=c99 you need to tell gcc you're still using recent versions of POSIX:

    #define _POSIX_C_SOURCE 199309L
    

    before any #include, or even with -D on the command line.

    Other errors:

    • Missing #include
    • You need a pointer for timer_create, i.e. &sigeventStruct instead of just sigeventStruct

提交回复
热议问题