Build for Visual Studio 2015

asked 2016-02-24 12:10:44 -0500

Hello, Please could you help me - I'm struggling to get going with OpenCV.

I'm having significant difficulties Building OpenCV 3.0.0 for Microsoft Visual Studio 2015 v14.0.24720.00 Following the steps in a tutorial blog, I have used cmake to create a set of build files, and then attempted to build from the solution created. I encounter a series of build errors relating to missing The build errors I have encountered are included here:

C:\fakepath\OpenCV_3_Build Errors.JPG

C:\fakepath\OpenCV_3_Build Errors2.JPG

C:\fakepath\OpenCV_3_Build Errors3.JPG

Please could you give me some advice on whether these could be related to a known issue

Thank you for your help


edit retag flag offensive close merge delete


Which version of cmake? Do you try to build opencv_contrib (opencv_extra_modules_path is not empty in cmake)? if yes you must download opencv_contrib too

LBerger gravatar imageLBerger ( 2016-02-24 14:12:26 -0500 )edit

Hi Thank you for your reply. I'm using Cmake 3.5.0. I am trying to use opencv_contrib and I have downloaded this to a file path and added this path in Cmake next to "OPENCV_EXTRA_MODULES_PATH".

JamesJoy gravatar imageJamesJoy ( 2016-02-24 16:01:09 -0500 )edit

Did you change any other settings? It looks like at least one of the paths or directories is wrong.

Tetragramm gravatar imageTetragramm ( 2016-02-24 18:06:29 -0500 )edit

So you have download source opencv from github and opencv_contrib too. Is it first error in your first link? (that's better to give full text error message inpost)

LBerger gravatar imageLBerger ( 2016-02-25 01:14:03 -0500 )edit

Thank you for your replies.

Yes that is correct, I have downloaded OpenCV 3, and contrib, set the source directory in the CMAKE GUI, and created a build directory for the build files. I have changed the setting in CMAKE to add the other modules path, I have set this to where I have downloaded the extra modules to, which is within the OpenCV directory I'm using in CMAKE. I haven't changed any other settings or edited the Cmakelists.txt file.

In the first set of errors, Visual Studio is looking for the file path: opencv2/core/hal/

From the location where CMAKEMakelists.txt is The actual file path is: modules/hal/include/opencv2/hal

I'm not quite sure where this should be corrected, I haven't made any changes to the Makelists file.

Best wishes J

JamesJoy gravatar imageJamesJoy ( 2016-02-25 04:39:46 -0500 )edit

I suggest you to delete cache in CMake file menu and configure and generate again using default parameter and try to build using VS 2015. You will not have opencv_contrib but if it works it's a first step...

LBerger gravatar imageLBerger ( 2016-02-25 05:53:01 -0500 )edit

I think what you need is to move the opencv_contrib path up one directory. Try LBerger's advice, then this.

Tetragramm gravatar imageTetragramm ( 2016-02-25 07:04:28 -0500 )edit

Thank you both for your suggestions. I have followed your suggestion of not including the extra contributions. This removes most of the errors, which suggests I am not including the extra code correctly.

I am now down to only two linker errors which relate to the same file:

C2861 operator cv:Matx<double,2,2> identifier not found (compiling source file c:\OpenCV\opencv\sources\modules\core\test\test_mat.cpp)

C2861 operator cv:Matx<double,2,2> no matching overloaded function found (compiling source file c:\OpenCV\opencv\sources\modules\core\test\test_mat.cpp)

Thank you for your help

JamesJoy gravatar imageJamesJoy ( 2016-02-27 10:58:50 -0500 )edit

Which lines? I cannot found it in opencv 3.1

LBerger gravatar imageLBerger ( 2016-02-27 11:30:13 -0500 )edit

I'm sorry, the lines are both 1597.

JamesJoy gravatar imageJamesJoy ( 2016-02-27 12:29:33 -0500 )edit