Check out example codes for "error: ‘sleep’ was not declared in this scope". It will help you in understanding the concepts better.

Code Example 1

#include <unistd.h>

Include unistd.h header file will solve the error.

"sleep" function in c++ context, include in header file "unistd.h" . 
otherwise we can see compilation error like below.

[email protected]:~/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

Learn ReactJs, React Native from