我尝试使用 MinGW 5.3.0 32位从其来源构建 OpenCV 3.2.0 vc14 ,以便使用Qt 5.8中的功能。我的平台是Windows 7 64位。
我遵循的主要说明是here,在Qt的维基上。在几个步骤中,我遇到了我尚未找到解决方案的错误。由于我是新手,我为自己的无助而道歉,并会批评任何建议。
错误1.在生成构建文件的阶段。
在cmake-gui( cmake-3.2.1-win32-x86 )中,我正好按照上面提到的Qt wiki文章中指定的步骤进行操作。但是,在最后一代中,最后会发生以下CMake错误:
CMake Error in modules/highgui/CMakeLists.txt:
No known features for CXX compiler
"GNU"
version 5.3.0.
Generating done
我想知道它如何影响项目文件以及它是否会导致下一个错误。
错误2.尝试构建OpenCV时
构建过程中途中断,记录以下内容:
In file included from C:/Qt/Tools/mingw530_32/i686-w64-
mingw32/include/c++/type_
traits:35:0,
from C:/Qt/5.8/mingw53_32/include/QtCore/qglobal.h:45,
from C:/Qt/5.8/mingw53_32/include/QtCore/QtCore:4,
from C:/Qt/5.8/mingw53_32/include/QtOpenGL/QtOpenGLDepends:3,
from C:/Qt/5.8/mingw53_32/include/QtOpenGL/QtOpenGL:3,
from C:/opencv/sources/modules/highgui/src/window_QT.h:46,
from C:\opencv\sources\modules\highgui\src\window_QT.cpp:47:
C:/Qt/Tools/mingw530_32/i686-w64-
mingw32/include/c++/bits/c++0x_warning.h:32:2:
error: #error This file requires compiler and library support for the ISO
C++ 2011 standard. This support is currently experimental, and must be
enabled with the -std=c++11 or -std=gnu++11 compiler options.
(...)
C:/Qt/5.8/mingw53_32/include/QtCore/qcompilerdetection.h:562:6: error:
#error Qt requires a C++11 compiler and yours does not seem to be that.
(...)
^
C:/Qt/5.8/mingw53_32/include/QtCore/qtypeinfo.h:62:40: error: expected
primary-expression before '>' token isIntegral = std::is_integral<T>::value,
^
C:/Qt/5.8/mingw53_32/include/QtCore/qtypeinfo.h:62:41: error: '::value' has
not been declared isIntegral = std::is_integral<T>::value,
注意:我还遇到了sprintf()
家庭安全错误。因此,我按照Alex's建议将add_definitions(-DSTRSAFE_NO_DEPRECATE)
添加到CMakeLists.txt的开头以抑制错误。
感谢您的时间。