Help regarding OpenCv and Visual Express C++ 10.0 for a 64 bit Windows 7 system

May 15, 2012 at 2:47pm
I have built Opencv using Cmake and then I am trying to run this code:
// OpenCV_Helloworld.cpp : Defines the entry point for the console application.
// Created for build/install tutorial, Microsoft Visual C++ 2010 Express and OpenCV 2.1.0

#include <cv.h>
#include <tchar.h>
#include "cxcore.h"
#include "highgui.h"


int _tmain(int argc, _TCHAR* argv[])
{
IplImage *img = cvLoadImage("funny-pictures-cat-goes-pew.jpg");
cvNamedWindow("Image:",1);
cvShowImage("image:",img);

cvWaitKey();
cvDestroyWindow("Image:");
cvReleaseImage(&img);

return 0;
}
But the error I am getting is :
1>------ Build started: Project: OpenCV_HelloWorld1, Configuration: Debug x64 ------
1>Open_HelloWorld1.obj : error LNK2019: unresolved external symbol cvReleaseImage referenced in function wmain
1>Open_HelloWorld1.obj : error LNK2019: unresolved external symbol cvDestroyWindow referenced in function wmain
1>Open_HelloWorld1.obj : error LNK2019: unresolved external symbol cvWaitKey referenced in function wmain
1>Open_HelloWorld1.obj : error LNK2019: unresolved external symbol cvShowImage referenced in function wmain
1>Open_HelloWorld1.obj : error LNK2019: unresolved external symbol cvNamedWindow referenced in function wmain
1>Open_HelloWorld1.obj : error LNK2019: unresolved external symbol cvLoadImage referenced in function wmain
1>C:\Users\Pratik\documents\visual studio 2010\Projects\OpenCV_HelloWorld1\x64\Debug\OpenCV_HelloWorld1.exe : fatal error LNK1120: 6 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

I have tried various combination i the net , please help me out
May 15, 2012 at 3:04pm
Did you link against opencv libraries ? I don't see any #pragma comment (lib, "<library name here>") in your code.
Of course, the linked in libraries can also be set from the Visual Studio IDE.
May 16, 2012 at 6:39pm
I am very new to this, please help me in how to do so . Please help.If u can give me an example taking the above code in to consideration it would be very helpful.
Regards,
tranquished.
May 16, 2012 at 7:18pm
The problem is not in your code. The problem is in your Visual Express.

You need to link the correct openCV libraries. I don't know how that's done as I don't use it. Google how to link libraries in Visual Express.
May 17, 2012 at 2:35am
Thanks Moschops , I have been doing that for a very long time but couldnt solve it.
May 17, 2012 at 9:22am
If you're unable to link against libraries after searching for a long time, perhaps a much simpler and easier IDE would be a good idea, or even abandoning an IDE and doing it from the command line (where it's very simple).
May 17, 2012 at 10:03am
If you don't know how to add a library to Visual Studio, for which there are plenty of tutorials and comprehensive help in MSDN then maybe programming is not for you.
Topic archived. No new replies allowed.