Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing openCV 2.4 for C/C++ for Visual Studio

I have been trying all day to install OpenCV (versions 2.4.1 and 2.4.2) for Visual Studio 2010 on Windows 7 for C/C++.

I have been following this tutorial: http://docs.opencv.org/trunk/doc/tutorials/introduction/windows_install/windows_install.html

I skipped installing 3rd party software (except python 2.7 and zlib from here: http://gnuwin32.sourceforge.net/packages/zlib.htm).

I run cmake, then open openCV.sln from openCV build directory, wait for visual studio to load and then build it. Visual studio gives 200 hundred errors which are just the following two repeated many times:

error C1083: Cannot open include file: 'unistd.h': No such file or directory

error LNK1104: cannot open file '....\lib\Debug\opencv_core241d.lib'

"OpenCV build directory"/bin/Release does not contain any *.exe file, just a plenty of *.pdb files, among which I can see contours.pdb. The tutorial says that I should see contours.exe there.

As there are no *.exe files, I understand that two errors I get during build are critical. I would be grateful for any ideas that could help me solve them.

like image 525
Jaroslaw Pawlak Avatar asked Jul 17 '12 16:07

Jaroslaw Pawlak


People also ask

Do I need Visual Studio for OpenCV?

Building the OpenCV library from scratch requires a couple of tools installed beforehand: An IDE of choice (preferably), or just a CC++ compiler that will actually make the binary files. Here we will use the Microsoft Visual Studio. However, you can use any other IDE that has a valid CC++ compiler.


1 Answers

The following interpretation of the build steps should help you build it:

  1. Install cmake - this is required for all platforms

  2. cd into the extracted directory and create a new directory called release(or any other name)

  3. From this directory, run cmake ..

  4. You should find an OpenCV.sln file in the release directory.

  5. Open this with Visual Stuido and run a build.

  6. Go ahead and enjoy Opencv

like image 57
go4sri Avatar answered Oct 24 '22 18:10

go4sri