-
-
Notifications
You must be signed in to change notification settings - Fork 56.5k
Description
System Information
OpenCV version: latest commit
OS: Windows 11
Compiler: MSVC 19.43.34617.95
Detailed description
I work on Microsoft Visual C++ testing, where we regularly build popular open-source projects, including yours, with development builds of our compiler and libraries to detect and prevent shipping regressions that would affect you. This also allows us to provide advance notice of breaking changes, which is the case here.
Recently microsoft/STL#5105, revealed an issue in OpenCV.
Compiler error with this STL change:
C:\gitP\opencv\opencv\modules\gapi\test\gapi_sample_pipelines.cpp(86,22): error C2653: 'high_resolution_clock': is not a class or namespace name [C:\gitP\opencv\opencv\build_amd64\modules\gapi\opencv_test_gapi.vcxproj]
C:\gitP\opencv\opencv\modules\gapi\test\gapi_sample_pipelines.cpp(86,45): error C3861: 'now': identifier not found [C:\gitP\opencv\opencv\build_amd64\modules\gapi\opencv_test_gapi.vcxproj]
C:\gitP\opencv\opencv\modules\gapi\test\gapi_sample_pipelines.cpp(91,38): error C2672: 'std::chrono::duration_cast': no matching overloaded function found Affected code:
opencv/modules/gapi/test/gapi_sample_pipelines.cpp
Lines 86 to 99 in 65d4112
| auto s = high_resolution_clock::now(); | |
| in.copyTo(out); | |
| auto e = high_resolution_clock::now(); | |
| const auto elapsed_in_ms = | |
| static_cast<int32_t>(duration_cast<milliseconds>(e-s).count()); | |
| int32_t diff = time_in_ms - elapsed_in_ms; | |
| const auto need_to_wait_in_ms = static_cast<uint32_t>(std::max(0, diff)); | |
| s = high_resolution_clock::now(); | |
| e = s; | |
| while (duration_cast<milliseconds>(e-s).count() < need_to_wait_in_ms) { | |
| e = high_resolution_clock::now(); |
This was assuming that including makes the chrono::high_resolution_clock type available, which is not guaranteed by the Standard. You need to explicitly include the chrono header in this file, and the error will be resolved.
Steps to reproduce
Build log: opencv.log
Issue submission checklist
- I report the issue, it's not a question
- I checked the problem with documentation, FAQ, open issues, forum.opencv.org, Stack Overflow, etc and have not found any solution
- I updated to the latest OpenCV version and the issue is still there
- There is reproducer code and related data files (videos, images, onnx, etc)