user5617096
user5617096

Reputation: 1

Visual Studio 2015 and opencv 3.0

I installed opencv 3.0 and extract. Then i open a project and add directories, libraries to the properperty but when i write simple test program it does not work. I followed tutorial.

#include "stdafx.h"

#include <iostream>
#include <opencv2/opencv.hpp>

void main()
{
    std::cout << "OpenCV Version: " << CV_VERSION << std::endl;
}

cannot open source file "opencv2/opencv.hpp"

identifier "CV_VERSION" is undefined

C2100 illegal indirection

Upvotes: 0

Views: 2381

Answers (1)

globalex
globalex

Reputation: 569

Update Opencv 3.1 just released and prebuild libs now support VC14 for Visual Studio 2015 . Just download opencv for windows from main page. Extract the opencv and use standard tutorials install opencv on windows: Instalation by using prebuild libs. Before you include header files you have to set enviromentall path by setx -m OPENCV_DIR command and in enviromental variables Path editor just set %OPENCV_DIR%\bin the folder where is DLLs are located.

If you want to use prebuild libs with Visual Studio 2015. You need some libs relater to older version.

One option is install redistributable Packages for older Visual Studio. And include this libs directly in your app from ProgramFiles/MicrosoftSDK/Windows/version/libs. This path find simply during the instalation. This is for Visual studio 2013 here Package Here

Better is recompile opencv with cmake and visual studio.

Build opencv with Visual Studio 2015 compiler from source first. This reduce a risk that older framework missing in your computer. You need vc14 directory as a source of your libs. Prebuild libs are only for VS 2012 and 2013, which is VC11 and VC12 libs folder under your opencv/build/x64 or x86. Speps are simple.

  1. Download CMAKE, install
  2. Download source code of Opencv, extract
  3. run Cmake and add directory of your source and target directory for your project.
  4. Configure Cmake just choose right compiler VS2015 first. There is many options. Just try the default one first.
  5. Run Cmake. Result is Visual Studio 2015 project like opencv.sln under target directory.
  6. Open opencv.sln project
  7. Build this project with Visual Studio 2015. Result is VC14 directory with libs to include.

Check this picture by picture tutorial. Tutorial Here

Upvotes: 1

Related Questions