einpoklum
einpoklum

Reputation: 132202

error: ‘Error’ is not a member of ‘cl’ - but it is

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

Answers (1)

einpoklum
einpoklum

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

Related Questions