Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
289 views
in Technique[技术] by (71.8m points)

c++ - Building 32bit libraries opencv

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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

    enter image description here

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

    enter image description here

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

enter image description here

  1. An options page will be listed.

    5.1. Edit CMAKE_INSTALL_PREFIX to change the install location if you want to.

    5.2. Select ENABLE_CXX11 if it isn't already selected.

    5.3. Change other options only if you are familiar with them. Then click Configure again and then click 'Generate` to generate make files.

  2. Modify opencvsourcesmodulesvideoiosrccap_dshow.cpp and add this define at the top of the file:

    #define STRSAFE_NO_DEPRECATE
    
  3. In command prompt( at build path ) type mingw32-make ( add mingw32-make folder to PATH if required )

  4. On completion, type mingw32-make install

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...