如何使用openCV依赖项使用C++ 20来编译我的项目?
我正在尝试使用G ++上的C ++ 20标志来构建我的项目。我的项目取决于OpenCV 4.0的OpenCV.HPP中的某些标题,现在我会从这些标头文件中获取编译器错误。我无法从OpenCV的文档中分辨出他们是否支持使用C ++ 20标志编译。我在哪里可以找到该信息?
还有一种方法可以解决这些错误吗?如何使用较旧的C ++标准编译他们的代码?但是我的代码使用C ++ 20?
这是我看到的编译器错误的片段:
In file included from /usr/include/opencv4/opencv2/core/mat.hpp:3724,
from /usr/include/opencv4/opencv2/core.hpp:59,
from /usr/include/opencv4/opencv2/opencv.hpp:52,
from /my_project/include/amp_ffmpeg/decoder.hpp:3,
from /my_project/src/decoder.cpp:1:
/usr/include/opencv4/opencv2/core/mat.inl.hpp: In constructor ‘cv::_InputArray::_InputArray(const cv::Mat&)’:
/usr/include/opencv4/opencv2/core/mat.inl.hpp:88:57: error: arithmetic between different enumeration types ‘cv::_InputArray::KindFlag’ and ‘cv::AccessFlag’ is deprecated [-Werror=deprecated-enum-enum-conversion]
88 | inline _InputArray::_InputArray(const Mat& m) { init(MAT+ACCESS_READ, &m); }
| ~~~^~~~~~~~~~~~
/usr/include/opencv4/opencv2/core/mat.inl.hpp: In constructor ‘cv::_InputArray::_InputArray(const std::vector<cv::Mat>&)’:
/usr/include/opencv4/opencv2/core/mat.inl.hpp:89:83: error: arithmetic between different enumeration types ‘cv::_InputArray::KindFlag’ and ‘cv::AccessFlag’ is deprecated [-Werror=deprecated-enum-enum-conversion]
89 | inline _InputArray::_InputArray(const std::vector<Mat>& vec) { init(STD_VECTOR_MAT+ACCESS_READ, &vec); }
I am trying to build my project with the c++20 flag on g++-11. My project depends on some headers in opencv.hpp from OpenCV 4.0, and now I'm getting compiler errors from these header files. I can't tell from OpenCV's docs if they support compiling with the c++20 flag. Where can I find that info?
Also is there a way to get around these errors? How could I compile their code with an older c++ standard?, but my code with c++20?
Here's a snippet of the compiler error that I'm seeing:
In file included from /usr/include/opencv4/opencv2/core/mat.hpp:3724,
from /usr/include/opencv4/opencv2/core.hpp:59,
from /usr/include/opencv4/opencv2/opencv.hpp:52,
from /my_project/include/amp_ffmpeg/decoder.hpp:3,
from /my_project/src/decoder.cpp:1:
/usr/include/opencv4/opencv2/core/mat.inl.hpp: In constructor ‘cv::_InputArray::_InputArray(const cv::Mat&)’:
/usr/include/opencv4/opencv2/core/mat.inl.hpp:88:57: error: arithmetic between different enumeration types ‘cv::_InputArray::KindFlag’ and ‘cv::AccessFlag’ is deprecated [-Werror=deprecated-enum-enum-conversion]
88 | inline _InputArray::_InputArray(const Mat& m) { init(MAT+ACCESS_READ, &m); }
| ~~~^~~~~~~~~~~~
/usr/include/opencv4/opencv2/core/mat.inl.hpp: In constructor ‘cv::_InputArray::_InputArray(const std::vector<cv::Mat>&)’:
/usr/include/opencv4/opencv2/core/mat.inl.hpp:89:83: error: arithmetic between different enumeration types ‘cv::_InputArray::KindFlag’ and ‘cv::AccessFlag’ is deprecated [-Werror=deprecated-enum-enum-conversion]
89 | inline _InputArray::_InputArray(const std::vector<Mat>& vec) { init(STD_VECTOR_MAT+ACCESS_READ, &vec); }
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论