Search code examples
c++visual-studio-2010opencvwindows-vista

I can't compile opencv samples with VS2010 on vista


I am using visual studio 2010 on windows vista. I want to compile a sample file of OPENCV named "find_obj.cpp" created by liuliu.

Here is the address of source code.

https://code.ros.org/trac/opencv/browser/trunk/opencv/samples/c/find_obj.cpp

Other opencv codes works well but I couldn't compile this. please help

I've installed all of the libraries needed and opencv. Other opencv projects of mine are working fine.

My error is "unresolved externals" here it is,

Error 14 error LNK1120: 11 unresolved externals
Error 4 error LNK2019: unresolved external symbol "class cvflann::Logger & __cdecl cvflann::logger(void)" (?logger@cvflann@@YAAAVLogger@1@XZ) referenced in function "public: virtual void __thiscall cvflann::KDTreeIndexParams::print(void)const " (?print@KDTreeIndexParams@cvflann@@UBEXXZ


Solution

  • I solved the problem. In this sample it uses flann functions and I added the opencv_flann220d.lib to libraries section in visual studio. Now, program compiles with no error.

    And I learned that if you're getting "unresolved externals" error it is mostly because of missing of include directories or libraries.

    greetings