Search code examples
visual-c++visual-studio-2012c++-cliopencv3.0

How do I get Microsoft Visual Studio 2017 to link to the OpenCV 3.4 libraries?


I have downloaded:

Microsoft Visual Studio 2017 (14.0)

Microsoft Visual C++ 2017 x64 (14.12.25810)

And OpenCV 3.4

I try to get this stackoverflow program to run.

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

usingnamespacecv;
usingnamespacestd;

intmain()
{
    Matim = imread("c:/full/path/to/lena.jpg");
    if(im.empty())
    {      
        cout<<"Cannotloadimage!"<< endl;
        return -1;
    }   
    imshow("Image", im);  
    waitKey(0);}

But I get an error:

cannot open source file 

"opencv2/highgui/highgui.hpp"

I have searched:

Opencv.org

Docs.opencv.org

Learnopencv.com

Stackoverflow.com

Gethub.com

Quora.com

AI shack

Google

None of these sites have given me an accurate solution to my first step modern problem. I have not found a way to #enclude the libraries. Does someone know the information that I am looking for?


Solution

  • Best answer is at:

    Installing OpenCV 2.4.3 in Visual C++ 2010 Express [closed]

    Realize that it must be updated for Visual Studio 2017 and OpenCV 3.4