C++ OpenCV 3.x 只包含一个库 - o​​pencv_world.lib?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/34867289/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-28 14:26:57  来源:igfitidea点击:

OpenCV 3.x only contains one lib - opencv_world.lib?

c++opencvcmakeopencv3.0

提问by marcman

I'm trying to update my OpenCV version from 2.4.9 to the newest version, 3.10. I downloaded the Windows binary from here, having navigated there from the official OpenCV site. I then ran the installer, but the opencv\build\x64\vc12\libdirectory only contained a couple files:

我正在尝试将我的 OpenCV 版本从 2.4.9 更新到最新版本 3.10。我从这里下载了 Windows 二进制文件,从官方 OpenCV 站点导航到那里。然后我运行了安装程序,但该opencv\build\x64\vc12\lib目录只包含几个文件:

  • opencv_world310.lib
  • opencv_world310d.lib
  • OpenCVConfig.cmake
  • OpenCVModules.cmake
  • OpenCVModules-debug.cmake
  • OpenCVModules-release.cmake
  • opencv_world310.lib
  • opencv_world310d.lib
  • OpenCVConfig.cmake
  • OpenCVModules.cmake
  • OpenCVModules-debug.cmake
  • OpenCVModules-release.cmake

In the past editions though, this directory used to contain the required libraries, like opencv_calib3d249d.lib, opencv_contrib249d.lib, opencv_core249d.lib, etc.

但是在过去的版本中,这个目录用于包含所需的库,如 opencv_calib3d249d.lib、opencv_contrib249d.lib、opencv_core249d.lib 等。

I imagine there's something I need to do with CMake, but I can't seem to figure it out--the old binaries used to compile everything for you. I also can't find anything in the documentation explaining this. Has anyone else come across this recently and have a solution?

我想我需要用 CMake 做一些事情,但我似乎无法弄清楚 - 用于为您编译所有内容的旧二进制文件。我也无法在解释此的文档中找到任何内容。最近有没有其他人遇到过这个问题并有解决方案?

回答by herohuyongtao

By default, the binary version of OpenCV-3.x doesn't contain the separate libs like opencv_core.lib. Instead, these modules are integrated in opencv_world.lib, so you only need to link to it.

默认情况下,OpenCV-3.x 的二进制版本不包含单独的库,如opencv_core.lib. 相反,这些模块集成在 中opencv_world.lib,因此您只需链接到它。

On the other hand, if you do want separate libs, i.e. uniform APIs with OpenCV-2.x, you can build it yourself using CMake by enable the libs that you want. Like

另一方面,如果您确实需要单独的库,即使用 OpenCV-2.x 的统一 API,您可以通过启用所需的库来使用 CMake 自己构建它。喜欢

enter image description here

在此处输入图片说明

This will generate opencv_core.lib.

这将生成opencv_core.lib.

回答by banderlog013

Or run cmake with -D BUILD_opencv_world=OFFkey

或使用-D BUILD_opencv_world=OFF密钥运行 cmake