c++ - CMAKE 3.4.1和VS2015编译opencv3.0 extra models时找不到include文件如何解决

标签 c++ visual-studio opencv cmake cross-compiling

使用 CMAKE 3.4.1 和 VS2015 构建 OPENCV 3.0 时。 VS2015 出现以下错误:

error   C2264   “std::tuple<cv::Size,perf::`anonymous-namespace'::MatDepth>::tuple”: error;opencv_perf_core E:\OpenCV3\sources\modules\core\perf\opencl\perf_channels.cpp   187 
error       Cannot open scr file "opencv2/core/hal/intrin.hpp"  opencv_xphoto   e:\OpenCV3\sources\modules\xphoto\src\grayworld_white_balance.cpp   43  
error   C1083   Cannot open include file: “opencv2/core/hal/intrin.hpp”: No such file or directory  opencv_xphoto   E:\OpenCV3\sources\modules\xphoto\src\grayworld_white_balance.cpp   43  
error   C2610   “std::tuple<cv::Size,perf::`anonymous-namespace'::MatDepth>::tuple(const std::tuple<cv::Size,perf::`anonymous-namespace'::MatDepth> &)”:  E:\OpenCV3\sources\modules\core\perf\opencl\perf_channels.cpp)    opencv_perf_core    D:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\tuple    328 
error   C2610   “std::tuple<cv::Size,perf::`anonymous-namespace'::MatDepth>::tuple(std::tuple<cv::Size,perf::`anonymous-namespace'::MatDepth> &&)”:  E:\OpenCV3\sources\modules\core\perf\opencl\perf_channels.cpp) opencv_perf_core    D:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\tuple    329 
error   C2535   “std::tuple<cv::Size,perf::`anonymous-namespace'::MatDepth> &std::tuple<cv::Size,perf::`anonymous-namespace'::MatDepth>::operator =(const std::tuple<cv::Size,perf::`anonymous-namespace'::MatDepth> &)”:  E:\OpenCV3\sources\modules\core\perf\opencl\perf_channels.cpp)   opencv_perf_core    D:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\tuple    463 
error   C2382   “std::tuple<cv::Size,perf::`anonymous-namespace'::MatDepth>::operator =”: E:\OpenCV3\sources\modules\core\perf\opencl\perf_channels.cpp)    opencv_perf_core    D:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\tuple    463 
error   C2264   “std::tuple<cv::Size,perf::`anonymous-namespace'::MatDepth>::tuple”: 函数定义或声明中有error;未调用函数   opencv_perf_core    E:\OpenCV3\sources\modules\core\perf\opencl\perf_channels.cpp   165 
error   C1083   Cannot open include file: “opencv2/core/hal/intrin.hpp”: No such file or directory  opencv_ximgproc E:\OpenCV3\sources\modules\ximgproc\src\fgs_filter.cpp  38  
error   C1083   Cannot open include file: “opencv2/core/hal/hal.hpp”: No such file or directory opencv_aruco    E:\OpenCV3\sources\modules\aruco\src\dictionary.cpp 44  
error   C1083   Cannot open include file: “opencv2/core/hal/hal.hpp”: No such file or directory opencv_ximgproc E:\OpenCV3\sources\modules\ximgproc\src\sparse_match_interpolators.cpp  41  
error   C1083   Cannot open include file: “opencv2/core/hal/hal.hpp”: No such file or directory opencv_xfeatures2d  E:\OpenCV3\sources\modules\xfeatures2d\src\sift.cpp 108 
error   C1083   Cannot open include file: “opencv2/core/hal/hal.hpp”: No such file or directory opencv_optflow  E:\OpenCV3\sources\modules\optflow\src\motempl.cpp  44  
error   LNK1104 Cannot open file“..\..\lib\Debug\opencv_aruco300d.lib”  opencv_test_aruco   E:\OpenCV3\sources\build\modules\aruco\LINK 1   
error   LNK1104 Cannot open file“..\..\lib\Debug\opencv_optflow300d.lib”    opencv_test_optflow E:\OpenCV3\sources\build\modules\optflow\LINK   1   
error   LNK1104 Cannot open file“..\..\lib\Debug\opencv_xfeatures2d300d.lib”    opencv_stitching    E:\OpenCV3\sources\build\modules\stitching\LINK 1   
error   LNK1104 Cannot open file“..\..\lib\Debug\opencv_stitching300d.lib”  opencv_perf_stitching   E:\OpenCV3\sources\build\modules\stitching\LINK 1   
error   LNK1104 Cannot open file“..\..\lib\Debug\opencv_xphoto300d.lib” opencv_perf_xphoto  E:\OpenCV3\sources\build\modules\xphoto\LINK    1   
error   LNK1104 Cannot open file“..\..\lib\Debug\opencv_ximgproc300d.lib”   opencv_perf_ximgproc    E:\OpenCV3\sources\build\modules\ximgproc\LINK  1   
error   LNK1104 Cannot open file“..\..\lib\Debug\opencv_xfeatures2d300d.lib”    opencv_perf_xfeatures2d E:\OpenCV3\sources\build\modules\xfeatures2d\LINK   1   
error   LNK1104 Cannot open file“..\..\lib\Debug\opencv_stitching300d.lib”  opencv_test_stitching   E:\OpenCV3\sources\build\modules\stitching\LINK 1   
error   C2065   “vector_Rect2d”: Undeclared identifier  opencv_python2  E:\OpenCV3\sources\build\modules\python2\pyopencv_generated_types.h 22172   
error   C2146   syntax error: missing“;”(在标识符“boundingBox”的前面)  opencv_python2  E:\OpenCV3\sources\build\modules\python2\pyopencv_generated_types.h 22172   
error   C2065   “boundingBox”: Undeclared identifier    opencv_python2  E:\OpenCV3\sources\build\modules\python2\pyopencv_generated_types.h 22172   
error   C2065   “boundingBox”: Undeclared identifier    opencv_python2  E:\OpenCV3\sources\build\modules\python2\pyopencv_generated_types.h 22179   
error   C2065   “boundingBox”: Undeclared identifier    opencv_python2  E:\OpenCV3\sources\build\modules\python2\pyopencv_generated_types.h 22181   
error   C2065   “vector_Rect2d”: Undeclared identifier  opencv_python2  E:\OpenCV3\sources\build\modules\python2\pyopencv_generated_types.h 22191   
error   C2146   syntax error: missing“;”    opencv_python2  E:\OpenCV3\sources\build\modules\python2\pyopencv_generated_types.h 22191   
error   C2065   “boundingBox”: Undeclared identifier    opencv_python2  E:\OpenCV3\sources\build\modules\python2\pyopencv_generated_types.h 22191   
error   C2065   “boundingBox”: Undeclared identifier    opencv_python2  E:\OpenCV3\sources\build\modules\python2\pyopencv_generated_types.h 22197   
error   C2065   “boundingBox”: Undeclared identifier    opencv_python2  E:\OpenCV3\sources\build\modules\python2\pyopencv_generated_types.h 22199   
error   C2065   “vector_Rect2d”: Undeclared identifier  opencv_python2  E:\OpenCV3\sources\build\modules\python2\pyopencv_generated_types.h 22216   
error   C2146   syntax error: missing“;”opencv_python2  E:\OpenCV3\sources\build\modules\python2\pyopencv_generated_types.h 22216   
error   C2065   “boundingBox”: Undeclared identifier    opencv_python2  E:\OpenCV3\sources\build\modules\python2\pyopencv_generated_types.h 22216   
error   C2065   “boundingBox”: Undeclared identifier    opencv_python2  E:\OpenCV3\sources\build\modules\python2\pyopencv_generated_types.h 22223   
error   C2065   “boundingBox”: Undeclared identifier    opencv_python2  E:\OpenCV3\sources\build\modules\python2\pyopencv_generated_types.h 22224   
error   C2065   “vector_Rect2d”: Undeclared identifier  opencv_python2  E:\OpenCV3\sources\build\modules\python2\pyopencv_generated_funcs.h 7839    
error   C2146   syntax error: missing“;”    opencv_python2  E:\OpenCV3\sources\build\modules\python2\pyopencv_generated_funcs.h 7839    
error   C2065   “boundingBox”: Undeclared identifier    opencv_python2  E:\OpenCV3\sources\build\modules\python2\pyopencv_generated_funcs.h 7839    
error   C2065   “boundingBox”: Undeclared identifier    opencv_python2  E:\OpenCV3\sources\build\modules\python2\pyopencv_generated_funcs.h 7846    
error   C2065   “boundingBox”: Undeclared identifier    opencv_python2  E:\OpenCV3\sources\build\modules\python2\pyopencv_generated_funcs.h 7848    
error   LNK1104 Cannot open file“..\..\lib\Debug\opencv_xfeatures2d300d.lib”    opencv_test_xfeatures2d E:\OpenCV3\sources\build\modules\xfeatures2d\LINK   1   
error   LNK1104 Cannot open file“..\..\lib\Debug\opencv_ximgproc300d.lib”   opencv_test_ximgproc    E:\OpenCV3\sources\build\modules\ximgproc\LINK  1   
error   LNK1104 Cannot open file“..\..\lib\Debug\opencv_xphoto300d.lib” opencv_test_xphoto  E:\OpenCV3\sources\build\modules\xphoto\LINK    1   

我认为问题可能来自“opencv2/core/hal/intrin.hpp”和“opencv2/core/hal/hal.hpp”。但是在我指定包含文件之后。代码中出现了更多问题,例如没有诸如 cv::hal 之类的东西。所以我完全迷失了错误。

我使用以下教程来配置和编译我的 Cmake 和 VS:https://putuyuwono.wordpress.com/2015/04/23/building-and-installing-opencv-3-0-on-windows-7-64-bit/

我需要使用 Xfeatures2d,那么我该怎么做才能做到这一点?非常感谢,圣诞快乐~

最佳答案

尝试使用 OpenCV 3.1 源代码构建。

由于您正在构建 Xfeatures2d,因此您似乎已将 opencv_contrib 模块添加到源代码树中。我在过去一周做了同样的事情,我下载的 opencv_contrib 版本只能使用现在可用的 OpenCV 3.1 构建。对于 OpenCV 3.0,我收到的第一条错误消息与您看到的完全相同(无法打开 scr 文件“opencv2/core/hal/intrin.hpp”)。似乎 hal 已移至 OpenCV 3.1 的核心。

试一试。现在,我在 Windows 7 下使用 Visual Studio 2012 成功构建了所有模块。注意:必须在 CMake 中设置“opencv_extra_modules_path”,我假设您还需要设置“with_cuda”(您可能已经检查过了)。我正在使用 CMake 2.8.12.2。

关于c++ - CMAKE 3.4.1和VS2015编译opencv3.0 extra models时找不到include文件如何解决,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34462222/

相关文章:

android - JNI- java.lang.UnsatisfiedLinkError : Native method not found

c++ - 修复未初始化的局部变量错误

c++ - 查找 std::wstring 的字符长度

c++ - 在虚幻中没有调用函数

visual-studio - Delphi (.NET) 的最佳替代 IDE 是什么

c++ - OpenCV cv::Mat 导致潜在的内存泄漏与 std::vector

c++ - 生命周期绑定(bind)到代码块的未命名对象?

visual-studio - 在 MSBuild 中删除目标位置的其他文件

c++ - Step Into (F11) 不进入 Visual Studio 2015 中的某些函数

math - 为什么有 3 个相互冲突的 OpenCV 相机标定公式?