'sleep' was not declared in this scope c++ code example

Example 1: 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);
  ^~~~~

Example 2: sleep not declared in this scope c++

" 's' should be in the form of uppercase in Sleep"

Tags:

Cpp Example