Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

LNK2019 Error When Building Version 3.1.0

First of all, I am a noob to both C++ and OpenCV, but I am not a noob to Visual Studio.

When trying to build a simple application (see below), I get LNK2019 errors beginning with complaints about the Mat class.

Mine is a simple console app. I installed OpenCVdefault v3.1.0 via NuGet. A dependency package called opencvdefault.redist was automatically installed in the process. I am using VS2017 with the Platform Toolset set to Visual Studio 2013 (v120). I tried setting the toolset to VS 2017 but got the same errors. In my project property pages, the Platform is set to x64.

I don't think it is material to the error condition, but prior to installing OpenCVdefault v3.1.0 via NuGet, I thought I might try compiling OpenCV. So I downloaded it, into a separate folder, of course, and set my environment variables with "setx -m OPENCV_DIR D:\OpenCV\Build\x64\vc12".

Please excuse the formatting below. I haven't gotten the hang of it yet.

#include "stdafx.h"

include <opencv2 opencv.hpp="">

using namespace cv;

int main() { // Read the image file Mat image = imread("D:/My OpenCV Website/Eagle.jpg"); return 0; }

click to hide/show revision 2
None

updated 2018-04-05 13:04:44 -0600

berak gravatar image

LNK2019 Error When Building Version 3.1.0

First of all, I am a noob to both C++ and OpenCV, but I am not a noob to Visual Studio.

When trying to build a simple application (see below), I get LNK2019 errors beginning with complaints about the Mat class.

Mine is a simple console app. I installed OpenCVdefault v3.1.0 via NuGet. A dependency package called opencvdefault.redist was automatically installed in the process. I am using VS2017 with the Platform Toolset set to Visual Studio 2013 (v120). I tried setting the toolset to VS 2017 but got the same errors. In my project property pages, the Platform is set to x64.

I don't think it is material to the error condition, but prior to installing OpenCVdefault v3.1.0 via NuGet, I thought I might try compiling OpenCV. So I downloaded it, into a separate folder, of course, and set my environment variables with "setx -m OPENCV_DIR D:\OpenCV\Build\x64\vc12".

Please excuse the formatting below. I haven't gotten the hang of it yet.

#include "stdafx.h"

include <opencv2 opencv.hpp="">

#include <opencv2/opencv.hpp> using namespace cv;

cv; int main() { // Read the image file Mat image = imread("D:/My OpenCV Website/Eagle.jpg"); return 0; }

}