C, error of compilation during using “usleep” function

后端 未结 2 1881
余生分开走
余生分开走 2020-12-22 10:22

I use Ubuntu Linux. When I try use \"usleep\" function, I get information about \"implicit declaration of function usleep\". Below is the error code:

muteks.         


        
2条回答
  •  粉色の甜心
    2020-12-22 10:30

    usleep() is declared in the standard header unistd.h which you haven't included. Include it:

    #include 
    

    On a relevant note: usleep() has been removed since POSIX-2008 and recommends to use nanosleep() instead.

提交回复
热议问题