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