title: Use OpenCL at Mac with xCode
body: <p>I have done some CUDA programming at Windows and now I want to learn OpenCL. I have Macbook retina which contains <code>Intel Iris</code> graphics card. I already have <code>xCode</code>. I tried to find a lot at internet about how can I check if OpenCL is already installed at my Mac but I could not understand a proper way. I just read that Macbook will automatically get OpenCL installed with xCode.</p>
  
  <p>I wrote few lines which are related to OpenCL but it throws error:</p>
  
  <pre><code>Undefined symbols for architecture x86_64:
    "_clGetPlatformIDs", referenced from:
        _main in main.o
  ld: symbol(s) not found for architecture x86_64
  clang: error: linker command failed with exit code 1 (use -v to see invocation)
  </code></pre>
  
  <p>I am completely new to OpenCL and unable to understand how things work with OpenCL.</p>
  
  <p><strong>My Code:</strong></p>
  
  <pre><code>#ifdef __APPLE__
  #include "OpenCL/opencl.h"
  #else
  #include "CL/cl.h"
  #endif
  
  #include &lt;iostream&gt;
  using namespace std;
  
  int main()
  {
      cl_uint platformIdCount = 0;
      clGetPlatformIDs (0, nullptr, &amp;platformIdCount);
  
      cout&lt;&lt;"Test openCL";
      return 0;
  }
  </code></pre>
  
  <p><strong>PS:</strong> Inclusion of header files does not throw any error. The error occurs due to <code>clGetPlatformIDs()</code> in the <code>main()</code>.</p>