gpt4 book ai didi

windows - 在 Windows 10 下使用 mingw 构建 OpenCV 时出错

转载 作者:太空宇宙 更新时间:2023-11-03 23:15:05 26 4
gpt4 key购买 nike

我尝试在我的 Windows 10 PC 上构建 opencv 库。我设法使用 cmake 从源代码生成所有内容。 (没有红色,没有错误)。当我尝试使用 mingw 构建所有内容时(mingw32-make install)它开始构建,过了一会儿我收到以下错误。

[ 76%] Building CXX object modules/python3/CMakeFiles/opencv_python3.dir/__/src2/cv2.cpp.obj
In file included from C:/Python34/include/Python.h:8:0,
from C:\OpenCV\opencv-master\modules\python\src2\cv2.cpp:6:
C:/Python34/include/pyconfig.h:440:5: warning: "_MSC_VER" is not defined [-Wundef]
#if _MSC_VER >= 1800
^~~~~~~~
In file included from C:/PROGRA~1/MINGW-~1/X86_64~1.0-P/mingw64/lib/gcc/x86_64-w64-mingw32/6.2.0/include/c++/math.h:36:0,
from C:/Python34/include/pyport.h:328,
from C:/Python34/include/Python.h:50,
from C:\OpenCV\opencv-master\modules\python\src2\cv2.cpp:6:
C:/PROGRA~1/MINGW-~1/X86_64~1.0-P/mingw64/lib/gcc/x86_64-w64-mingw32/6.2.0/include/c++/cmath:1133:11: error: '::hypot' has not been declared
using ::hypot;
^~~~~
modules\python3\CMakeFiles\opencv_python3.dir\build.make:179: recipe for target 'modules/python3/CMakeFiles/opencv_python3.dir/__/src2/cv2.cpp.obj' failed
mingw32-make[2]: *** [modules/python3/CMakeFiles/opencv_python3.dir/__/src2/cv2.cpp.obj] Error 1
CMakeFiles\Makefile2:7051: recipe for target 'modules/python3/CMakeFiles/opencv_python3.dir/all' failed
mingw32-make[1]: *** [modules/python3/CMakeFiles/opencv_python3.dir/all] Error 2
Makefile:159: recipe for target 'all' failed
mingw32-make: *** [all] Error 2

我找到了以下 "Error: '::hypot' has not been declared" in cmath while trying to embed Python

但是想不通。任何人都可以在方向上暗示我。在构建 OpenCV 的情况下,这些包括在哪里?

版本:OpenCV 3.2.0,CMake 3.4.1,GNU 制作 4.1

任何帮助都将不胜感激!

最佳答案

转到以下文件

C:\OpenCV\opencv-master\modules\python\src2\cv2.cpp  

然后看看 #include "Python.h"
#include <cmath> 之前.
在那种情况下交换订单,即写

#include <cmath>
#include "Python.h"

所以cmathPython.h 之前.
尝试构建并查看是否在列表中解决了您报告的错误。

关于windows - 在 Windows 10 下使用 mingw 构建 OpenCV 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41620160/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com