sleep not declared in this scope c 2b 2b

Solutions on MaxInterview for sleep not declared in this scope c 2b 2b by the best coders in the world

showing results for - "sleep not declared in this scope c 2b 2b"
Roberta
05 Nov 2020
1Solution:
2#include <unistd.h>
3
4Include unistd.h header file will solve the error.
5
6Explanation:
7"sleep" function in c++ context, include in header file "unistd.h" . 
8otherwise we can see compilation error like below.
9
10prashad@ubuntu:~/test$ g++ open_videofile.cpp  `pkg-config --cflags --libs opencv` -g 
11open_videofile.cpp: In function ‘int main(int, char**)’:
12open_videofile.cpp:34:2: error: ‘sleep’ was not declared in this scope
13  sleep(5);
14  ^~~~~
15
16 
Camilla
28 Jun 2020
1" 's' should be in the form of uppercase in Sleep"
similar questions
queries leading to this page
sleep not declared in this scope c 2b 2b