Ask Your Question
2

Retrying to use opencv- this time 25 linker errors- win7 64bit vc10 vs2010

asked 2012-09-06 08:11:58 -0600

Despair gravatar image

workspace windows 7 64bit. visual studio 2010 vc10 getting linker problems. i followed the instructions completely AGAIN but cant get it to work. just added every single folder to the properties page all include folders, to the c++ general line. all the library folders ( x64) to the linker general

and all the lib names from the folder to linker input: opencv_calib3d242d.lib opencv_contrib242d.lib opencv_core242d.lib opencv_features2d242d.lib opencv_flann242d.lib opencv_gpu242d.lib opencv_haartraining_engined.lib opencv_highgui242d.lib opencv_imgproc242d.lib opencv_legacy242d.lib opencv_ml242d.lib opencv_nonfree242d.lib opencv_objdetect242d.lib opencv_photo242d.lib opencv_stitching242d.lib opencv_ts242d.lib opencv_video242d.lib opencv_videostab242d.lib

still got 25 linker errors . no idea what i can do.

1>Main.obj : error LNK2001: unresolved external symbol "void __cdecl cv::namedWindow(class std::basic_string<char,struct std::char_traits<char="">,class std::allocator<char> > const &,int)" (?namedWindow@cv@@YAXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@H@Z) 1>Main.obj : error LNK2001: unresolved external symbol "void __cdecl cv::absdiff(class cv::_InputArray const &,class cv::_InputArray const &,class cv::_OutputArray const &)" (?absdiff@cv@@YAXABV_InputArray@1@0ABV_OutputArray@1@@Z) 1>Main.obj : error LNK2001: unresolved external symbol "public: __thiscall cv::_InputArray::_InputArray(class cv::Mat const &)" (??0_InputArray@cv@@QAE@ABVMat@1@@Z) 1>Main.obj : error LNK2001: unresolved external symbol "void __cdecl cv::divide(class cv::_InputArray const &,class cv::_InputArray const &,class cv::_OutputArray const &,double,int)" (?divide@cv@@YAXABV_InputArray@1@0ABV_OutputArray@1@NH@Z) 1>Main.obj : error LNK2001: unresolved external symbol "void __cdecl cv::GaussianBlur(class cv::_InputArray const &,class cv::_OutputArray const &,class cv::Size_<int>,double,double,int)" (?GaussianBlur@cv@@YAXABV_InputArray@1@ABV_OutputArray@1@V?$Size_@H@1@NNH@Z) 1>Main.obj : error LNK2001: unresolved external symbol "void __cdecl cv::fastFree(void )" (?fastFree@cv@@YAXPAX@Z) 1>Main.obj : error LNK2001: unresolved external symbol "class cv::Scalar_<double> __cdecl cv::mean(class cv::_InputArray const &,class cv::_InputArray const &)" (?mean@cv@@YA?AV?$Scalar_@N@1@ABV_InputArray@1@0@Z) 1>Main.obj : error LNK2001: unresolved external symbol "class cv::_OutputArray const & __cdecl cv::noArray(void)" (?noArray@cv@@YAABV_OutputArray@1@XZ) 1>Main.obj : error LNK2001: unresolved external symbol "public: void __thiscall cv::Mat::copySize(class cv::Mat const &)" (?copySize@Mat@cv@@QAEXABV12@@Z) 1>Main.obj : error LNK2001: unresolved external symbol "public: void __thiscall cv::Mat::deallocate(void)" (?deallocate@Mat@cv@@QAEXXZ) 1>Main.obj : error LNK2001: unresolved external symbol "public: class cv::MatExpr __thiscall cv::Mat::mul(class cv::_InputArray const &,double)const " (?mul@Mat@cv@@QBE?AVMatExpr@2@ABV_InputArray@2@N@Z) 1>Main.obj : error LNK2001: unresolved external symbol "public: void __thiscall cv::Mat::convertTo(class cv::_OutputArray const &,int,double,double)const " (?convertTo@Mat@cv@@QBEXABV_OutputArray@2@HNN@Z) 1>Main.obj : error LNK2001: unresolved external symbol "class cv::MatExpr __cdecl cv::operator(double,class cv::Mat const &)" (??Dcv@@YA?AVMatExpr@0@NABVMat@0@@Z) 1>Main.obj : error LNK2001: unresolved external symbol "void __cdecl cv::subtract(class cv::_InputArray const &,class cv::_InputArray const &,class cv::_OutputArray const ... (more)

edit retag flag offensive close merge delete

Comments

retried again and still linker errors... could it be because i have VS2012 installed also?

Despair gravatar imageDespair ( 2012-09-07 11:39:57 -0600 )edit

3 answers

Sort by ยป oldest newest most voted
3

answered 2012-09-09 10:10:46 -0600

Daniil Osokin gravatar image

updated 2012-09-09 10:13:49 -0600

Hi, I've especially for you installed opencv (my configuration the same: win7 64bit vc10 vs2010). All works fine, no problems.

What I've done:

  • downloaded from sourceforge opencv 2.4.2
  • unpacked it (let's say to D:\)
  • created in vs2010 empty console application
  • added include folder "D:\opencv\build\include" (project->properties-> C/C++ ->general->additional include directories)
  • added lib folder "D:\opencv\build\x86\vc10\lib" - as I've created win32 project configuration by default (project->properties->linker->general->additional library directories).


To test this, I call cvtColor in the project. For this stuff you need to:

  • add opencv_core242d.lib and opencv_imgproc242d.lib libs in project (project->properties->linker->input->additional dependencies) - used debug configuration, so "d" - postfix in libs names.

  • put bin files in the solution directory: opencv_core242d.dll and opencv_imgproc242d.dll (from D:\opencv\build\x86\vc10\bin)

    Now you can run this project.

edit flag offensive delete link more
1

answered 2012-09-07 15:58:46 -0600

unxnut gravatar image

Have you specified the location of the library files in the settings? I have mine specified in Tools->Options->Library Files.

In case you have not, that should fix the problem.

edit flag offensive delete link more

Comments

First, thanks for answering.

Yes, I have the library folder set in the C++ Directories menu. Also it is set in the additional libraries (inside the linker menu). And finally in the linker input menu there are all the lib files (Additional Dependencies)

any idea what i might be forgetting? :O thanks!

Despair gravatar imageDespair ( 2012-09-08 02:51:27 -0600 )edit
0

answered 2012-11-13 10:21:59 -0600

SR gravatar image

updated 2012-11-13 10:23:07 -0600

I assume that you build your program in debug mode. Otherwise you have to remove the "d"s at the end of each libray name.

These errors are most likely due to one of the following:

  1. You have forgotten to specify a library path or it is simply invalid.
  2. Your program is compiled for x86 but the linker tries to link against the x64 libraries of OpenCV or vice versa. Same name, different architecture = won't work.
edit flag offensive delete link more

Question Tools

Stats

Asked: 2012-09-06 08:11:58 -0600

Seen: 3,923 times

Last updated: Nov 13 '12