Ask Your Question
1

errors building opencv with visual studio 2013

asked 2014-03-06 16:03:25 -0600

jossyy gravatar image

updated 2014-03-06 16:10:16 -0600

unxnut gravatar image

Hello,

I searched my problem here, but I dont find a specific solution for my problem. I run the below code, it is ok

int main(int argc, _TCHAR* argv[])
{
    cv::Mat img();  
    return 0;
}

but I run the below code, it is failed.

int main(int argc, _TCHAR* argv[])
{
    Mat img = imread("deneme.png", 1);
    //imshow("opencv Window", img);
    return 0;
}

The error is : unresolved external. Could you help me please?

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
4

answered 2014-03-06 16:13:09 -0600

unxnut gravatar image

updated 2014-03-06 16:13:58 -0600

You probably did not add the highgui library in the linker. Go to project settings, check for linker, and add the highgui library based on the OpenCV distribution that you have. If you are running OpenCV 2.4.8, it would probably be opencv_highgui248d.lib. And in case you have not, please also add opencv_core248d.lib.

edit flag offensive delete link more

Comments

I hope that I do it, my lib is opencv_core244d.lib . I am beginner opencv. Maybe I did it in a wrong path. Could you tell me true path?

jossyy gravatar imagejossyy ( 2014-03-06 16:22:04 -0600 )edit

I tried it properties -> Linker -> General , it is true?

jossyy gravatar imagejossyy ( 2014-03-06 16:30:57 -0600 )edit
1

You will need to specify the location of library files in your system. Do that in Project->Properties->Linker->General->Additional Library Directories. The libraries are specified in Project->Properties->Linker->Input->Additional Dependencies. I'll suggest that you find the location of your libraries by doing a search in Windows and specifying that in your project properties.

unxnut gravatar imageunxnut ( 2014-03-06 16:31:44 -0600 )edit

I did it , but there is same error :(

jossyy gravatar imagejossyy ( 2014-03-06 16:41:39 -0600 )edit

The problem is solved! Thanks unxhut...

jossyy gravatar imagejossyy ( 2014-03-06 17:28:18 -0600 )edit
0

answered 2014-04-19 15:47:47 -0600

Y Simson gravatar image

I to had a lot of problems compiling OpenCV on my computer with visual studio 2013. Here are general guidelines I wrote. If I missed something please add to it:

OPENCV INSTALLATION INSTRUCTIONS:

A) 64 vs 32 bit conflicts Make sure the $OPENCV_DIR refers to the right version

For example you have two alternatives in OpenCV 2.4.8:
1) D:\OpenCV\opencv\build\x86\vc11     (32 bits)
2) D:\OpenCV\opencv\build\x64\vc11     (64 bits)

Make sure that your project definition is suited to the right bittage.

How can you check/correct this?
-Right click on solution->properties->Configuration Properties->Platform
-Choose either 64/32 bits depending on what you want

How to define $OPENCV_DIR?
click on start -> Right click on "Computer" -> Properties -> Advanced System setting -> Choose "Advanced" tab -> Environment Variables -> Click on "New..." under System Variables -> For Variable Name enter: OPENCV_DIR -> For Variable Value enter relevant build directory.

B) Including header directory: Make sure to add to the configuration Properties of the project: C++->General->Include Additional Directories->$(OPENCV_DIR)....\include

C) Add OpenCV bin folder to: Linker->General->Additional Library Directories->$(OPENCV_DIR)\lib;

D) Add libs's to: Linker->Input->Additional Dependencies->

For debug copy and paste:
opencv_calib3d247d.lib;opencv_contrib247d.lib;opencv_core247d.lib;opencv_features2d247d.lib;opencv_flann247d.lib;opencv_gpu247d.lib;opencv_highgui247d.lib;opencv_imgproc247d.lib;opencv_legacy247d.lib;opencv_ml247d.lib;opencv_nonfree247d.lib;opencv_objdetect247d.lib;opencv_photo247d.lib;opencv_stitching247d.lib;opencv_superres247d.lib;opencv_ts247d.lib;opencv_video247d.lib;opencv_videostab247d.lib;

For release copy and paste:
opencv_calib3d247.lib;opencv_contrib247.lib;opencv_core247.lib;opencv_features2d247.lib;opencv_flann247.lib;opencv_gpu247.lib;opencv_highgui247.lib;opencv_imgproc247.lib;opencv_legacy247.lib;opencv_ml247.lib;opencv_nonfree247.lib;opencv_objdetect247.lib;opencv_photo247.lib;opencv_stitching247.lib;opencv_superres247.lib;opencv_ts247.lib;opencv_video247.lib;opencv_videostab247.lib;

E) For runtime make sure that you have the right DLL folder in your Path: e.g. %OPENCV_DIR%\bin

edit flag offensive delete link more

Comments

I am sorry for I am late. I watched a video , I sent it you.. http://www.youtube.com/watch?v=KO6BswerTDM

jossyy gravatar imagejossyy ( 2014-04-27 07:40:34 -0600 )edit

Question Tools

Stats

Asked: 2014-03-06 16:03:25 -0600

Seen: 1,001 times

Last updated: Apr 19 '14