hi, i'm trying to install the OpenCV on windows 7 but I'm reaching an error which says mutex and thread is not a member of std. I've downloaded both opencv and it's contribs and unzipped them in the root/opencv/source direction. first i generated it with cmake afterward i tried to use the command:
make -j5
in order to compile it, but, I'm facing with the error of:
c:\ROOT\opencv\opencv>cd c://root/opencv/opencv && make -j5
[ 2%] Built target zlib
[ 6%] Built target libtiff
[ 10%] Built target libjpeg
[ 15%] Built target libwebp
[ 19%] Built target libjasper
[ 21%] Built target libpng
[ 27%] Built target IlmImf
[ 27%] Built target opencv_core_pch_dephelp
[ 28%] Built target pch_Generate_opencv_core
[ 33%] Built target opencv_core
[ 33%] Built target opencv_test_core_pch_dephelp
[ 33%] Built target pch_Generate_opencv_test_core
[ 33%] Built target opencv_imgproc_pch_dephelp
[ 33%] Built target pch_Generate_opencv_imgproc
[ 38%] Built target opencv_imgproc
[ 38%] Built target opencv_videoio_pch_dephelp
[ 38%] Built target pch_Generate_opencv_videoio
[ 38%] Built target opencv_imgcodecs_pch_dephelp
[ 38%] Built target pch_Generate_opencv_imgcodecs
[ 40%] Built target opencv_imgcodecs
[ 41%] Built target opencv_videoio
[ 41%] Built target opencv_highgui_pch_dephelp
[ 41%] Built target pch_Generate_opencv_highgui
[ 41%] Built target opencv_highgui
[ 41%] Built target opencv_ts_pch_dephelp
[ 41%] Built target pch_Generate_opencv_ts
[ 42%] Built target opencv_ts
[ 45%] Built target opencv_test_core
[ 45%] Built target opencv_perf_core_pch_dephelp
[ 45%] Built target pch_Generate_opencv_perf_core
[ 48%] Built target opencv_perf_core
[ 48%] Built target opencv_flann_pch_dephelp
[ 48%] Built target pch_Generate_opencv_flann
[ 49%] Built target opencv_flann
[ 49%] Built target opencv_test_flann_pch_dephelp
[ 49%] Built target pch_Generate_opencv_test_flann
[ 50%] Built target opencv_test_flann
[ 50%] Built target opencv_perf_imgproc_pch_dephelp
[ 50%] Built target opencv_test_imgproc_pch_dephelp
[ 50%] Built target pch_Generate_opencv_test_imgproc
[ 54%] Built target opencv_test_imgproc
[ 54%] Built target pch_Generate_opencv_perf_imgproc
[ 58%] Built target opencv_perf_imgproc
[ 58%] Built target opencv_test_ml_pch_dephelp
[ 58%] Built target pch_Generate_opencv_test_ml
[ 58%] Built target opencv_ml_pch_dephelp
[ 59%] Built target pch_Generate_opencv_ml
[ 61%] Built target opencv_ml
[ 62%] Built target opencv_test_ml
[ 63%] Built target opencv_photo_pch_dephelp
[ 63%] Built target pch_Generate_opencv_photo
[ 64%] Built target opencv_photo
[ 64%] Built target opencv_perf_photo_pch_dephelp
[ 64%] Built target pch_Generate_opencv_perf_photo
[ 65%] Built target opencv_perf_photo
[ 65%] Built target opencv_test_photo_pch_dephelp
[ 65%] Built target pch_Generate_opencv_test_photo
[ 66%] Built target opencv_test_photo
[ 66%] Built target opencv_video_pch_dephelp
[ 67%] Built target pch_Generate_opencv_video
[ 69%] Built target opencv_video
[ 69%] Built target opencv_test_video_pch_dephelp
[ 69%] Built target pch_Generate_opencv_test_video
[ 70%] Built target opencv_test_video
[ 70%] Built target opencv_perf_video_pch_dephelp
[ 71%] Built target pch_Generate_opencv_perf_video
[ 72%] Built target opencv_perf_video
[ 72%] Built target opencv_test_imgcodecs_pch_dephelp
[ 72%] Built target opencv_perf_imgcodecs_pch_dephelp
[ 73%] Built target pch_Generate_opencv_test_imgcodecs
[ 74%] Built target opencv_test_imgcodecs
[ 75%] Built target pch_Generate_opencv_perf_imgcodecs
[ 75%] Built target opencv_perf_imgcodecs
[ 75%] Built target opencv_shape_pch_dephelp
[ 75%] Built target pch_Generate_opencv_shape
[ 75%] Built target opencv_shape
[ 76%] Built target opencv_test_shape_pch_dephelp
[ 77%] Built target pch_Generate_opencv_test_shape
[ 77%] Built target opencv_test_shape
[ 77%] Built target opencv_test_videoio_pch_dephelp
[ 77%] Built target pch_Generate_opencv_test_videoio
[ 78%] Built target opencv_test_videoio
[ 78%] Built target opencv_perf_videoio_pch_dephelp
[ 78%] Built target pch_Generate_opencv_perf_videoio
[ 79%] Built target opencv_perf_videoio
[ 79%] Built target opencv_test_highgui_pch_dephelp
[ 79%] Built target pch_Generate_opencv_test_highgui
[ 79%] Built target opencv_test_highgui
[ 79%] Built target opencv_perf_objdetect_pch_dephelp
[ 79%] Built target opencv_objdetect_pch_dephelp
[ 79%] Built target pch_Generate_opencv_objdetect
[ 79%] Building CXX object modules/objdetect/CMakeFiles/opencv_objdetect.dir/src/detection_based_tracker.cpp.obj
C:\ROOT\opencv\sources\modules\objdetect\src\detection_based_tracker.cpp:175:14: error: 'thread' in namespace 'std' does not name a type
std::thread second_workthread;
^~~~~~
C:\ROOT\opencv\sources\modules\objdetect\src\detection_based_tracker.cpp:176:14: error: 'mutex' in namespace 'std' does not name a type
std::mutex mtx;
^~~~~
C:\ROOT\opencv\sources\modules\objdetect\src\detection_based_tracker.cpp:177:14: error: 'condition_variable' in namespace 'std' does not name a type
std::condition_variable objectDetectorRun;
^~~~~~~~~~~~~~~~~~
C:\ROOT\opencv\sources\modules\objdetect\src\detection_based_tracker.cpp:178:14: error: 'condition_variable' in namespace 'std' does not name a type
std::condition_variable objectDetectorThreadStartStop;
^~~~~~~~~~~~~~~~~~
C:\ROOT\opencv\sources\modules\objdetect\src\detection_based_tracker.cpp: In member function 'void cv::DetectionBasedTracker::SeparateDetectionWork::setParameters(const c
v::DetectionBasedTracker::Parameters&)':
C:\ROOT\opencv\sources\modules\objdetect\src\detection_based_tracker.cpp:143:30: error: 'mutex' is not a member of 'std'
std::unique_lock<std::mutex> mtx_lock(mtx);
^~~
C:\ROOT\opencv\sources\modules\objdetect\src\detection_based_tracker.cpp:143:30: error: 'mutex' is not a member of 'std'
C:\ROOT\opencv\sources\modules\objdetect\src\detection_based_tracker.cpp:143:40: error: template argument 1 is invalid
std::unique_lock<std::mutex> mtx_lock(mtx);
^
C:\ROOT\opencv\sources\modules\objdetect\src\detection_based_tracker.cpp:143:51: error: 'mtx' was not declared in this scope
std::unique_lock<std::mutex> mtx_lock(mtx);
^~~
C:\ROOT\opencv\sources\modules\objdetect\src\detection_based_tracker.cpp:143:42: warning: unused variable 'mtx_lock' [-Wunused-variable]
std::unique_lock<std::mutex> mtx_lock(mtx);
^~~~~~~~
C:\ROOT\opencv\sources\modules\objdetect\src\detection_based_tracker.cpp: In member function 'void cv::DetectionBasedTracker::SeparateDetectionWork::init()':
C:\ROOT\opencv\sources\modules\objdetect\src\detection_based_tracker.cpp:156:30: error: 'mutex' is not a member of 'std'
std::unique_lock<std::mutex> mtx_lock(mtx);
^~~
C:\ROOT\opencv\sources\modules\objdetect\src\detection_based_tracker.cpp:156:30: error: 'mutex' is not a member of 'std'
C:\ROOT\opencv\sources\modules\objdetect\src\detection_based_tracker.cpp:156:40: error: template argument 1 is invalid
std::unique_lock<std::mutex> mtx_lock(mtx);
^
C:\ROOT\opencv\sources\modules\objdetect\src\detection_based_tracker.cpp:156:51: error: 'mtx' was not declared in this scope
std::unique_lock<std::mutex> mtx_lock(mtx);
^~~
C:\ROOT\opencv\sources\modules\objdetect\src\detection_based_tracker.cpp:164:13: error: 'objectDetectorThreadStartStop' was not declared in this scope
objectDetectorThreadStartStop.notify_one();
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\ROOT\opencv\sources\modules\objdetect\src\detection_based_tracker.cpp:156:42: warning: unused variable 'mtx_lock' [-Wunused-variable]
std::unique_lock<std::mutex> mtx_lock(mtx);
^~~~~~~~
C:\ROOT\opencv\sources\modules\objdetect\src\detection_based_tracker.cpp: In destructor 'virtual cv::DetectionBasedTracker::SeparateDetectionWork::~SeparateDetectionWork(
)':
C:\ROOT\opencv\sources\modules\objdetect\src\detection_based_tracker.cpp:253:5: error: 'second_workthread' was not declared in this scope
second_workthread.join();
^~~~~~~~~~~~~~~~~
C:\ROOT\opencv\sources\modules\objdetect\src\detection_based_tracker.cpp: In member function 'bool cv::DetectionBasedTracker::SeparateDetectionWork::run()':
C:\ROOT\opencv\sources\modules\objdetect\src\detection_based_tracker.cpp:260:22: error: 'mutex' is not a member of 'std'
std::unique_lock<std::mutex> mtx_lock(mtx);
^~~
C:\ROOT\opencv\sources\modules\objdetect\src\detection_based_tracker.cpp:260:22: error: 'mutex' is not a member of 'std'
C:\ROOT\opencv\sources\modules\objdetect\src\detection_based_tracker.cpp:260:32: error: template argument 1 is invalid
std::unique_lock<std::mutex> mtx_lock(mtx);
^
C:\ROOT\opencv\sources\modules\objdetect\src\detection_based_tracker.cpp:260:43: error: 'mtx' was not declared in this scope
std::unique_lock<std::mutex> mtx_lock(mtx);
^~~
C:\ROOT\opencv\sources\modules\objdetect\src\detection_based_tracker.cpp:274:5: error: 'second_workthread' was not declared in this scope
second_workthread = std::thread(workcycleObjectDetectorFunction, (void*)this); //TODO: add attributes?
^~~~~~~~~~~~~~~~~
C:\ROOT\opencv\sources\modules\objdetect\src\detection_based_tracker.cpp:274:25: error: 'thread' is not a member of 'std'
second_workthread = std::thread(workcycleObjectDetectorFunction, (void*)this); //TODO: add attributes?
^~~
C:\ROOT\opencv\sources\modules\objdetect\src\detection_based_tracker.cpp:275:5: error: 'objectDetectorThreadStartStop' was not declared in this scope
objectDetectorThreadStartStop.wait(mtx_lock);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\ROOT\opencv\sources\modules\objdetect\src\detection_based_tracker.cpp: In member function 'void cv::DetectionBasedTracker::SeparateDetectionWork::workcycleObjectDetect
or()':
C:\ROOT\opencv\sources\modules\objdetect\src\detection_based_tracker.cpp:316:22: error: 'mutex' is not a member of 'std'
std::unique_lock<std::mutex> mtx_lock(mtx);
^~~
C:\ROOT\opencv\sources\modules\objdetect\src\detection_based_tracker.cpp:316:22: error: 'mutex' is not a member of 'std'
C:\ROOT\opencv\sources\modules\objdetect\src\detection_based_tracker.cpp:316:32: error: template argument 1 is invalid
std::unique_lock<std::mutex> mtx_lock(mtx);
^
C:\ROOT\opencv\sources\modules\objdetect\src\detection_based_tracker.cpp:316:43: error: 'mtx' was not declared in this scope
std::unique_lock<std::mutex> mtx_lock(mtx);
^~~
C:\ROOT\opencv\sources\modules\objdetect\src\detection_based_tracker.cpp:322:9: error: 'objectDetectorThreadStartStop' was not declared in this scope
objectDetectorThreadStartStop.notify_one();
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\ROOT\opencv\sources\modules\objdetect\src\detection_based_tracker.cpp:329:9: error: 'objectDetectorRun' was not declared in this scope
objectDetectorRun.wait(mtx_lock);
^~~~~~~~~~~~~~~~~
C:\ROOT\opencv\sources\modules\objdetect\src\detection_based_tracker.cpp:339:14: error: request for member 'unlock' in 'mtx_lock', which is of non-class type 'int'
mtx_lock.unlock();
^~~~~~
C:\ROOT\opencv\sources\modules\objdetect\src\detection_based_tracker.cpp:356:22: error: request for member 'lock' in 'mtx_lock', which is of non-class type 'int'
mtx_lock.lock();
^~~~
C:\ROOT\opencv\sources\modules\objdetect\src\detection_based_tracker.cpp:363:26: error: request for member 'unlock' in 'mtx_lock', which is of non-class type 'int'
mtx_lock.unlock();
^~~~~~
C:\ROOT\opencv\sources\modules\objdetect\src\detection_based_tracker.cpp:371:13: error: 'objectDetectorRun' was not declared in this scope
objectDetectorRun.wait(mtx_lock);
^~~~~~~~~~~~~~~~~
C:\ROOT\opencv\sources\modules\objdetect\src\detection_based_tracker.cpp:379:22: error: request for member 'unlock' in 'mtx_lock', which is of non-class type 'int'
mtx_lock.unlock();
^~~~~~
C:\ROOT\opencv\sources\modules\objdetect\src\detection_based_tracker.cpp:430:18: error: request for member 'lock' in 'mtx_lock', which is of non-class type 'int'
mtx_lock.lock();
^~~~
C:\ROOT\opencv\sources\modules\objdetect\src\detection_based_tracker.cpp:446:18: error: request for member 'unlock' in 'mtx_lock', which is of non-class type 'int'
mtx_lock.unlock();
^~~~~~
C:\ROOT\opencv\sources\modules\objdetect\src\detection_based_tracker.cpp: In member function 'void cv::DetectionBasedTracker::SeparateDetectionWork::stop()':
C:\ROOT\opencv\sources\modules\objdetect\src\detection_based_tracker.cpp:461:20: error: 'mutex' is not a member of 'std'
std::unique_lock<std::mutex> mtx_lock(mtx);
^~~
C:\ROOT\opencv\sources\modules\objdetect\src\detection_based_tracker.cpp:461:20: error: 'mutex' is not a member of 'std'
C:\ROOT\opencv\sources\modules\objdetect\src\detection_based_tracker.cpp:461:30: error: template argument 1 is invalid
std::unique_lock<std::mutex> mtx_lock(mtx);
^
C:\ROOT\opencv\sources\modules\objdetect\src\detection_based_tracker.cpp:461:41: error: 'mtx' was not declared in this scope
std::unique_lock<std::mutex> mtx_lock(mtx);
^~~
C:\ROOT\opencv\sources\modules\objdetect\src\detection_based_tracker.cpp:467:18: error: request for member 'unlock' in 'mtx_lock', which is of non-class type 'int'
mtx_lock.unlock();
^~~~~~
C:\ROOT\opencv\sources\modules\objdetect\src\detection_based_tracker.cpp:478:5: error: 'objectDetectorRun' was not declared in this scope
objectDetectorRun.notify_one();
^~~~~~~~~~~~~~~~~
C:\ROOT\opencv\sources\modules\objdetect\src\detection_based_tracker.cpp:479:5: error: 'objectDetectorThreadStartStop' was not declared in this scope
objectDetectorThreadStartStop.wait(mtx_lock);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\ROOT\opencv\sources\modules\objdetect\src\detection_based_tracker.cpp:481:14: error: request for member 'unlock' in 'mtx_lock', which is of non-class type 'int'
mtx_lock.unlock();
^~~~~~
C:\ROOT\opencv\sources\modules\objdetect\src\detection_based_tracker.cpp: In member function 'void cv::DetectionBasedTracker::SeparateDetectionWork::resetTracking()':
C:\ROOT\opencv\sources\modules\objdetect\src\detection_based_tracker.cpp:494:22: error: 'mutex' is not a member of 'std'
std::unique_lock<std::mutex> mtx_lock(mtx);
^~~
C:\ROOT\opencv\sources\modules\objdetect\src\detection_based_tracker.cpp:494:22: error: 'mutex' is not a member of 'std'
C:\ROOT\opencv\sources\modules\objdetect\src\detection_based_tracker.cpp:494:32: error: template argument 1 is invalid
std::unique_lock<std::mutex> mtx_lock(mtx);
^
C:\ROOT\opencv\sources\modules\objdetect\src\detection_based_tracker.cpp:494:43: error: 'mtx' was not declared in this scope
std::unique_lock<std::mutex> mtx_lock(mtx);
^~~
C:\ROOT\opencv\sources\modules\objdetect\src\detection_based_tracker.cpp:511:14: error: request for member 'unlock' in 'mtx_lock', which is of non-class type 'int'
mtx_lock.unlock();
^~~~~~
C:\ROOT\opencv\sources\modules\objdetect\src\detection_based_tracker.cpp: In member function 'bool cv::DetectionBasedTracker::SeparateDetectionWork::communicateWithDetect
ingThread(const cv::Mat&, std::vector<cv::Rect_<int> >&)':
C:\ROOT\opencv\sources\modules\objdetect\src\detection_based_tracker.cpp:532:22: error: 'mutex' is not a member of 'std'
std::unique_lock<std::mutex> mtx_lock(mtx);
^~~
C:\ROOT\opencv\sources\modules\objdetect\src\detection_based_tracker.cpp:532:22: error: 'mutex' is not a member of 'std'
C:\ROOT\opencv\sources\modules\objdetect\src\detection_based_tracker.cpp:532:32: error: template argument 1 is invalid
std::unique_lock<std::mutex> mtx_lock(mtx);
^
C:\ROOT\opencv\sources\modules\objdetect\src\detection_based_tracker.cpp:532:43: error: 'mtx' was not declared in this scope
std::unique_lock<std::mutex> mtx_lock(mtx);
^~~
C:\ROOT\opencv\sources\modules\objdetect\src\detection_based_tracker.cpp:565:9: error: 'objectDetectorRun' was not declared in this scope
objectDetectorRun.notify_one();
^~~~~~~~~~~~~~~~~
C:\ROOT\opencv\sources\modules\objdetect\src\detection_based_tracker.cpp:572:14: error: request for member 'unlock' in 'mtx_lock', which is of non-class type 'int'
mtx_lock.unlock();
^~~~~~
make[2]: *** [modules/objdetect/CMakeFiles/opencv_objdetect.dir/src/detection_based_tracker.cpp.obj] Error 1
make[1]: *** [modules/objdetect/CMakeFiles/opencv_objdetect.dir/all] Error 2
make: *** [all] Error 2
in the process of compilation. What can i do to fix this error? Thanks in Advance,
Regards