构建32位库opencv [英] Building 32bit libraries opencv

查看:239
本文介绍了构建32位库opencv的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近下载并使用 cmake 在我的64位Windows机器上构建了opencv。所有二进制文件都包含在 install 文件夹中,它只包含如下所示的文件夹:



我不知道如何配置cmake来生成x86的二进制文件。我问这个,因为我使用 Qt Creator 32位与MinGW ,我在链接和编译代码时遇到问题。什么是正确的方法来做建立?我使用 mingw 编译器套件。



注意:下载的软件包包含预构建的二进制 x86 ,但是没有针对MinGW,但只针对Visual Studio。

解决方案

cmake-gui 的mingw步骤/ qt-5-3-1-64-bit-mingw-windows /rel =nofollow>指南。我们也可以很容易地在命令提示符下用 cmake -m32 选项。但是使用 cmake-gui 会让你更好地了解opencv配置的可用选项,如果你想自定义opencv的构建方式, OpenCL等)。


  1. 启动cmake-gui。

  2. 设置源路径到下载的opencv目录和构建路径




  3. 单击配置按钮并将generator指定为mingw makefiles as


  4. 选择编译器(这里我们选择32位)作为图像,然后单击完成按钮。


  1. 将会列出一个选项页面。编辑 CMAKE_INSTALL_PREFIX
    更改安装位置。更改其他选项只有当你是
    熟悉他们。然后再次点击配置,然后点击生成生成make文件。


  2. 在构建路径) mingw32-make (将 mingw32-make code>如果需要)


  3. 完成后,输入 mingw32-make install


I recently downloaded and built opencv in my 64-bit Windows machine using cmake. All the binaries are included in the install folder and it contains only the folders as shown below:

I don't know how to config cmake to produce binaries for x86. I'm asking this, because I'm using Qt Creator 32bit with MinGW and I'm getting problems while linking and compiling the code. What's the proper way to do the build? I'm using mingw compiler suite.

Note: The downloaded package contains the pre-built binaries for x86 but there are none for MinGW, but only for Visual Studio.

解决方案

Steps for mingw from with cmake-gui from this guide. We could also do this easily on command prompt with cmake and -m32 option. But using cmake-gui will give you more idea about the options available for opencv configuration and bring you in better position if you want to customize opencv build tomorrow ( like enabling java wrapper or OpenCL etc ).

  1. Start cmake-gui.
  2. Set source path to downloaded opencv directory and build path to your choice as in image

  3. Click Configure button and specify generator as mingw makefiles as in image

  4. Choose compilers ( here we choose 32 bit ) as in image and click Finish button.

  1. An options page will be listed. Edit CMAKE_INSTALL_PREFIX for changing install location. Change other options only if you are familiar with them. Then click Configure again and then click 'Generate` to generate make files.

  2. In command prompt( at build path ) type mingw32-make ( add mingw32-make folder to PATH if required )

  3. On completion, type mingw32-make install

这篇关于构建32位库opencv的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆