Your code snippet is making use of the OpenCL C++ bindings, which are defined in a different header file to the main OpenCL API (which is C). The header you need (cl.hpp
) isn't included on OS X systems by default, so you'll have to download it directly from the the Khronos OpenCL Registry (make sure you get the version listed under 1.2). You then just need to include this header from your code.
The typical books that get recommended for learning OpenCL are "OpenCL Programming Guide (Munshi, Gaster, Mattson, Fung, Ginsberg)" and "Heterogeneous Computing with OpenCL (Gaster, Howes, Kaeli)". There's also plenty of free tutorial material on the web, such as the Hands-on OpenCL tutorial on Github.