Ask Your Question

Opencv OpenCL Compilation error: x was not declared in this scope

asked 2013-09-22 18:28:45 -0600

mainul gravatar image

Hi I created a program using OpenCV in windows with visual studio. My program has two cpp files. Both of them include many library files. The main function is in detect.cpp file and the other file is lbp.cpp. In windows the program runs just fine and can get every library files and header files. But when I tried to compile the program in Linux it did not compile and gave me error. The file cannot find opencl's function and data type. It gives me this error:

‘cl_command_queue’ was not declared in this scope ‘cl_mem’ was not declared in this scope ‘cl_int’ was not declared in this scope

There are many of them. Anyone has an idea how to solve them? I checked other sample files and used the same headers as they used. But my program just does not compile. Please help.

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted

answered 2013-09-26 05:03:24 -0600

decision gravatar image

updated 2013-09-26 05:04:27 -0600

Include <OpenCl/cl.h> or so, depeding on the OpenCL SDK you're using. Notice that you need that if you're using anything OpenCL-related that's not completely wrapped inside OpenCV.

edit flag offensive delete link more


Thank you. I passed the location of opencl while compiling the codes.

mainul gravatar imagemainul ( 2013-09-26 13:06:34 -0600 )edit

Great. Please mark the answer as useful and/or the thread as solved. Thanks.

decision gravatar imagedecision ( 2013-10-02 05:19:50 -0600 )edit

I do not know how to mark it as solved. I dont see any icon for that.

mainul gravatar imagemainul ( 2013-10-30 09:44:37 -0600 )edit

Question Tools


Asked: 2013-09-22 18:28:45 -0600

Seen: 962 times

Last updated: Sep 26 '13