Reputation: 132202
I'm trying to use the C++ bindings for OpenCL. This seems to be working; but when I try throwing an OpenCL-associated exception (myself), the code won't compile:
/path/to/src.cpp: error: ‘Error’ is not a member of ‘cl’
throw cl::Error(result);
but I know there is a cl::Error
class in the cl.hpp
header. Why am I getting this error?
Upvotes: 0
Views: 193
Reputation: 132202
In order for the OpenCL C++ bindings to also define (and use?) exceptions, you have to have:
#define __CL_ENABLE_EXCEPTIONS
before including cl.hpp
. Otherwise cl::Error
is #ifdef
'ed out of existence.
Upvotes: 2