2
votes

I am trying to build this sample opencv application with visual studio 2012:

https://github.com/Itseez/opencv/blob/2.4/samples/ocl/surf_matcher.cpp

To do this, I download and install opencv 2.4.6 and installed it on my system.

Configured visual studio 2012 to use it (set include path, library path and libraries)

I checked and I added all libraries in opencv\build\x86\vc11\staticlib to my application (I take care that debug libraries were added to debug build and release libraries to release build).

I am compiling the code, I am getting several link error:

Error   1   error LNK2019: unresolved external symbol "public: __thiscall cv::ocl::SURF_OCL::SURF_OCL(double,int,int,bool,float,bool)" (??0SURF_OCL@ocl@cv@@QAE@NHH_NM0@Z) referenced in function "public: __thiscall `anonymous namespace'::SURFDetector<class cv::ocl::SURF_OCL>::SURFDetector<class cv::ocl::SURF_OCL>(double)" (??0?$SURFDetector@VSURF_OCL@ocl@cv@@@?A0x1f01e08d@@QAE@N@Z) 

Error   7   error LNK2001: unresolved external symbol _clReleaseMemObject@4 ConsoleApplication1\opencv_ocl246d.lib(arithm.obj)  

There are several of them and all of them seems related to ocl library.

Which other library should I add for OCL to work?

Note:

When I tried to compile, I got the following error:

'getDeviceInfo' : is not a member of 'cv::ocl::Context' 

on this code:

if(!useCPU)
{
    std::cout
            << "Device name:"
            << cv::ocl::Context::getContext()->getDeviceInfo().deviceName
            << std::endl;
}

This error seems relates to different ocl.hpp which is around. I used the github version (See answers for detail) and after changing the header that it needs, compile error solved.

1

1 Answers

0
votes

There are several versions of OpenCV. In one of them cv::ocl::Context does not have getDeviceInfo method. http://fossies.org/dox/opencv-2.4.6.1/classcv_1_1ocl_1_1Context.html

Second: https://github.com/Itseez/opencv/blob/master/modules/ocl/include/opencv2/ocl.hpp has it. I think you should use github's version.

UPD:

I think you need to build github version of the library to solve the first link error. You have missed https://github.com/Itseez/opencv/blob/master/modules/nonfree/src/surf.ocl.cpp . Also you must to install OpenCL SDK (Intel, AMD or CUDA depending on you graphics card) to solve the other one.

NVidia: https://developer.nvidia.com/opencl

AMD (both CPU and GPU): http://developer.amd.com/resources/heterogeneous-computing/opencl-zone/

Intel (both CPU and GPU): http://software.intel.com/en-us/vcsource/tools/opencl-sdk