error: ‘sleep’ was not declared in this scope code example
Example: error: ‘sleep’ was not declared in this scope
Solution:
#include <unistd.h>
Include unistd.h header file will solve the error.
Explanation:
"sleep" function in c++ context, include in header file "unistd.h" .
otherwise we can see compilation error like below.
prashad@ubuntu:~/test$ g++ open_videofile.cpp `pkg-config --cflags --libs opencv` -g
open_videofile.cpp: In function ‘int main(int, char**)’:
open_videofile.cpp:34:2: error: ‘sleep’ was not declared in this scope
sleep(5);
^~~~~