Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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