error in using cmake to build opencv3.2

蹲街弑〆低调 提交于 2019-12-12 04:34:07

问题


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.

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

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

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)


回答1:


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

For me the solution was:

  • deleting the content of the build target folder,
  • restarting cmake
  • unchecking the 3 options: 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.



来源:https://stackoverflow.com/questions/43772663/error-in-using-cmake-to-build-opencv3-2

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!