Ask Your Question

Installation Question

asked 2015-05-23 10:10:37 -0500

I have downloaded Open CV version 3.0 RC1 and Visual Studio 2015 RC and I want to start doing some basic projects in c/c++. My operating system is Windows 7.

I have read something about setting up and OpenCV enviroment variable and adding it to the systems path ( but this relates to an older version.

I am a bit lost at the moment and I was just wondering if any of you more experienced users could tell me the steps needed to get this up and running so I can start doing some projects. (If you are stuck for time, just the next step will do)

Thanks in advance

edit retag flag offensive close merge delete


I opened cmd and typed the following:

setx -m OPENCV_DIR D:\OpenCV\Build\x64\vc15

Got the following error message:

Access to registry path is denied.

Then I changed the original command to read:

setx OPENCV_DIR D:\OpenCV\Build\x64\vc11

I got: SUCCESS: Specified value was saved

Just wondering is this ok since I am using Visual Studio 2015 not 2012 which it appears the installation tutorial was created for. Also what is the relevance of dropping the '-m'?

monkeyvision gravatar imagemonkeyvision ( 2015-05-23 13:15:58 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2015-05-25 05:46:08 -0500

pklab gravatar image

1st of all you have downloaded binaries or source ? In case of "sources" you have build the libraries it before to go on. This requires additional effort if you are newbie.

In case of "binaries" consider that 3.0rc1 binaries are available up to VS2013.

Anyway the tutorial is aged but information are still valid. Summary is: In Visual Studio you have to configure include path, lib path and libraries files to link.

You can do this in many different way in global settings or project settings using Visual Studio Properties. In any case you have to set:

where the compiler can find OpenCV include file ?

Properties> C/C++ > General >Additional Include Dir: <YOUR_OCV_ROOT_PATH>/build/include

where the compiler can find OpenCV lib file ?

Properties> Linker > General > Additional Library Dir: <YOUR_OCV_ROOT_PATH>/build/x64/vc12/lib

which libraries you want to consider/link ?

Properties> Linker > Input > Additional Dependencies: list of all .lib files in Additional Library Path

remember that dynamic lib files with d postfix are debug version so opencv_ts300.lib is a release version while opencv_ts300d.lib is a debug version

The tutorial explains how to create an envvar (by command line) to store YOUR_OCV_ROOT_PATH so you can use later.

You can do this manually using Properties>User macro and define your own macro. Suppose you have OpenCV in c:\libs\OpenCV-300 you could define a global macro or local macro OPENCV_DIR value c:\libs\OpenCV-300.

Than you can use the macro to configure Compiler and Linker Options like this

Properties> C/C++ > General >Additional Include Dir: $(OPENCV_DIR)/build/include  
Properties> Linker > General > Additional Library Dir: $(OPENCV_DIR)/build/x64/vc12/lib

Some path might be different for example vc12 refers to Visual Studio 2013 and x64 refers to 64bit version of the libraries but try to understand the logic and adapt information to your settings.

finally you have to copy the DLL files you are using from $(OPENCV_DIR)/build/x64/vc12/bin/ to your executable path or in your system path

I hope this helps

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2015-05-23 10:10:37 -0500

Seen: 627 times

Last updated: May 25 '15