include - Why Am I Getting An Error (C)? -


this question has answer here:

i'm trying use usleep function unistd.h library. however, after included library @ top of function, error still persists. here error:

anfernee@aj-crunchbang:~/dropbox/cscape/tesla$ make calculator clang -ggdb3 -o0 -std=c99 -wall -werror -lm -lcs50    calculator.c   -o calculator calculator.c:20:2: error: implicit declaration of function 'usleep' invalid in c99 [-werror,-wimplicit-function-declaration]         usleep(180000);         ^ 1 error generated. make: *** [calculator] error 1 anfernee@aj-crunchbang:~/dropbox/cscape/tesla$ ^c anfernee@aj-crunchbang:~/dropbox/cscape/tesla$  

here code there error is.

#include <stdio.h> #include <math.h> #include <stdlib.h> #include <unistd.h>  #define clear printf("\033[2j");printf("\033[%d;%dh", 0, 0); //creates constant clears console screen   void presistance(void); //calculates total resistance resistors in parallel //void truth(void); //determines truth table logic gates specified void eforce(void); //calculated electric force void ohm(void); //calculates power  int main(void){     int option; //stores user's option      int exit = 0;     printf("\033[0;36;40m"); //changes colour of screen cyan      printf("welcome!\n"); //greet user      usleep(180000); 

what doing wrong?

usleep() obsolete. use nanosleep() or setitimer() alternatives.


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -