Error LNK2019 from C++ VS2015 Help To FIX

asked 2016-03-19 06:31:56 -0500

Nisal gravatar image

I'm new to OpenCv and I'm trying to install to Visual Studio 2015.

I got install NuGet Package of Opencv 2.4.10. Then I copied some example code just check whether it working or not. When building, there are some LINK errors.

eg: Error LNK2019 unresolved external symbol "void __cdecl cv::fastFree(void *)" (?fastFree@cv@@YAXPAX@Z) referenced in function "public: __thiscall cv::Mat::~Mat(void)" (??1Mat@cv@@QAE@XZ) ConsoleApplication2 F:\Research\Test\ConsoleApplication2\ConsoleApplication2\Source.obj 1

The test code I used is..

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

#include <iostream>

using namespace cv;

using namespace std;

int main(int argc, char** argv)
{
if (argc != 2)
{
    cout << " Usage: display_image ImageToLoadAndDisplay" << endl;
    return -1;
}

Mat image;
image = imread(argv[1], CV_LOAD_IMAGE_COLOR);   // Read the file

if (!image.data)                              // Check for invalid input
{
    cout << "Could not open or find the image" << std::endl;
    return -1;
}

namedWindow("Display window", WINDOW_AUTOSIZE);// Create a window for display.
imshow("Display window", image);                   // Show our image inside it.

waitKey(0);                                          // Wait for a keystroke in the window
return 0;
}

image description

edit retag flag offensive close merge delete

Comments

  • are you linking any opencv libs ?
  • opencv does not maintain any nuget packages, careful there.
berak gravatar imageberak ( 2016-03-19 07:52:23 -0500 )edit

Ok thank you. But I tried Opencv 3.1.0 in Visual Studio 2015(downloaded manually through site). I added environment variables and linked the libraries as those tutorials say. It didn't work well.

What do you prefer to me to start with. (version i should download and how to proceed in brief) ? i ll will help to me a lot.

Nisal gravatar imageNisal ( 2016-03-19 08:03:58 -0500 )edit