【发布时间】:2020-04-27 17:04:51
【问题描述】:
我在 Visual Studio 2019 社区版中使用 opencv 和 gdal,我编写了一些示例测试以了解 opencv 和 gdal 在我的计算机上是否正常工作,但是随后出现了一些头文件错误,所有这些错误都没有影响程序的编译和程序的运行或输出,除了那些头文件语法错误,一切都很好,这让我很困惑。我的代码在下面:
/*opencv_test*/
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc.hpp>
#include <iostream>
using namespace cv;
using namespace std;
int main()
{
Mat image = Mat::zeros(300, 600, CV_8UC3);
circle(image, Point(250, 150), 100, Scalar(0, 255, 128), -100);
circle(image, Point(350, 150), 100, Scalar(255, 255, 255), -100);
imshow("Display Window", image);
waitKey(0);
return 0;
}
错误列表如下:
Warning C26451 Arithmetic overflow: Using operator '*' on a 4 byte value and then casting the result to a 8 byte value. Cast the value to the wider type before calling operator '*' to avoid overflow (io.2). opencv_test C:\MSVC_Library\OpenCV\opencv\build\include\opencv2\core C:\MSVC_Library\OpenCV\opencv\build\include\opencv2\core\mat.inl.hpp 550
Warning C6294 Ill-defined for-loop: initial condition does not satisfy test. Loop body not executed. opencv_test C:\MSVC_Library\OpenCV\opencv\build\include\opencv2\core C:\MSVC_Library\OpenCV\opencv\build\include\opencv2\core\matx.hpp 553
Warning C26812 The enum type 'cv::AccessFlag' is unscoped. Prefer 'enum class' over 'enum' (Enum.3). opencv_test C:\MSVC_Library\OpenCV\opencv\build\include\opencv2\core C:\MSVC_Library\OpenCV\opencv\build\include\opencv2\core\mat.hpp 66
我希望有人能真诚地回答我的问题。
【问题讨论】:
-
那些是警告,不是 错误;很大的不同(尽管您可能想摆脱这些)。
-
好的,我再发一个问题。@Adrian Mole
标签: c++ visual-studio opencv syntax-error header-files