使用cmake构建opencv3.2的错误。

时间:2022-09-27 04:55:18

I want to using the contrib part of opencv3.2, so i have to build it from sources. Here is my setting: windows10, vs2013, cmake-gui-3.8.1. after configuration in cmake-gui, i click the generator button, and i get the error message below. I am new to opencv, and i couldn't figure out how to solve it. Anyone who can help, THANKS.

我想使用opencv3.2的设计部分,所以我必须从源代码构建它。这是我的设置:windows10, vs2013, cgui -3.8.1。在cmake-gui中的配置之后,我单击生成器按钮,然后我得到下面的错误消息。我是opencv的新手,我不知道该怎么解决它。谁能帮忙,谢谢。

CMake Error at E:/Program Files/opencv/opencv/source/opencv-3.2.0/cmake/OpenCVUtils.cmake:911 (add_library): Cannot find source file:

CMake错误在E:/程序文件/opencv/opencv/source/opencv-3.2.0/ CMake /OpenCVUtils。cmake:911 (add_library):无法找到源文件:

E:/Program Files/opencv/opencv/build/modules/xfeatures2d/opencv_xfeatures2d_pch.cpp

艾凡:/程序文件/ opencv / / xfeatures2d / opencv_xfeatures2d_pch.cpp opencv /构建/模块

Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp .hxx .in .txx Call Stack (most recent call first): E:/Program Files/opencv/opencv/source/opencv-3.2.0/cmake/OpenCVModule.cmake:784 (ocv_add_library) E:/Program Files/opencv/opencv/source/opencv-3.2.0/cmake/OpenCVModule.cmake:729 (_ocv_create_module) E:/Program Files/opencv/opencv/source/opencv-3.2.0/cmake/OpenCVModule.cmake:940 (ocv_create_module) E:/Program Files/opencv/opencv/source/opencv_contrib-3.2.0/modules/xfeatures2d/CMakeLists.txt:2 (ocv_define_module)

尝试过扩展。c .c .c .c .c .c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .。cmake:784(ocv_add_library)E:/程序文件/ opencv / opencv / / opencv-3.2.0 / cmake / OpenCVModule来源。cmake:729(_ocv_create_module)E:/程序文件/ opencv / opencv / / opencv-3.2.0 / cmake / OpenCVModule来源。cmake:940(ocv_create_module)E:/程序文件/ opencv / opencv / / opencv_contrib-3.2.0 /模块/ xfeatures2d / CMakeLists来源。txt:2(ocv_define_module)

1 个解决方案

#1


1  

I had the same issue with generating the opencv solution with contrib in cmake.

我也有同样的问题,用cmake来生成opencv解决方案。

For me the solution was:

对我来说,解决办法是:

  • deleting the content of the build target folder,
  • 删除构建目标文件夹的内容,
  • restarting cmake
  • 重新启动cmake
  • unchecking the 3 options: BUILD_opencv_world, ,ENABLE_PRECOMPILED_HEADERS
  • 取消对三个选项的检查:BUILD_opencv_world,,ENABLE_PRECOMPILED_HEADERS。

To be honest I don't know what is exactly going on but I'll try to give an educated guess.

说实话,我不知道到底发生了什么,但我会试着给出一个有根据的猜测。

The problem seems to be, that when trying to build the "world" modules of opencv and opencv_contrib precompiled headers are needed, which are missing in the source package of opencv_contrib. The indication for that is, that as soon as BUILD_opencv_contrib_world and BUILD_opencv_world are checked the option ENABLE_PRECOMPILED_HEADERS disappears. And obviously the precompiled headers (..._pch.cpp) are missing.

问题似乎是,在试图构建opencv和opencv_b的“世界”模块时,需要在opencv_contrib的源包中丢失。也就是说,一旦build_opencv_writeb_world和BUILD_opencv_world被检查,选项ENABLE_PRECOMPILED_HEADERS就会消失。很明显,预编译头(…_pch.cpp)丢失了。

#1


1  

I had the same issue with generating the opencv solution with contrib in cmake.

我也有同样的问题,用cmake来生成opencv解决方案。

For me the solution was:

对我来说,解决办法是:

  • deleting the content of the build target folder,
  • 删除构建目标文件夹的内容,
  • restarting cmake
  • 重新启动cmake
  • unchecking the 3 options: BUILD_opencv_world, ,ENABLE_PRECOMPILED_HEADERS
  • 取消对三个选项的检查:BUILD_opencv_world,,ENABLE_PRECOMPILED_HEADERS。

To be honest I don't know what is exactly going on but I'll try to give an educated guess.

说实话,我不知道到底发生了什么,但我会试着给出一个有根据的猜测。

The problem seems to be, that when trying to build the "world" modules of opencv and opencv_contrib precompiled headers are needed, which are missing in the source package of opencv_contrib. The indication for that is, that as soon as BUILD_opencv_contrib_world and BUILD_opencv_world are checked the option ENABLE_PRECOMPILED_HEADERS disappears. And obviously the precompiled headers (..._pch.cpp) are missing.

问题似乎是,在试图构建opencv和opencv_b的“世界”模块时,需要在opencv_contrib的源包中丢失。也就是说,一旦build_opencv_writeb_world和BUILD_opencv_world被检查,选项ENABLE_PRECOMPILED_HEADERS就会消失。很明显,预编译头(…_pch.cpp)丢失了。