title: why are my openCL builds failing on OS X?
body: <p>I'm on OS X 10.7 Lion and have all the dev tools installed, but when I run GCC on a relatively simple program, just straight C with a few calls to openCL functions like <code>clCreateProgramFromSource</code> and the like, I get the following list of errors:</p>
  
  <pre><code>Undefined symbols for architecture x86_64:
    "_CreateContext", referenced from:
      _build_kernel in ccFuZYMI.o
    "_GetDevices", referenced from:
      _build_kernel in ccFuZYMI.o
    "_CreateCommandQueue", referenced from:
      _build_kernel in ccFuZYMI.o
    "_clCreateProgramWithSource", referenced from:
      _build_kernel in ccFuZYMI.o
    "_clBuildProgram", referenced from:
      _build_kernel in ccFuZYMI.o
    "_clCreateKernel", referenced from:
      _build_kernel in ccFuZYMI.o
    "_clCreateBuffer", referenced from:
      _build_kernel in ccFuZYMI.o
    "_clEnqueueWriteBuffer", referenced from:
      _sync_run_kernel in ccFuZYMI.o
    "_clSetKernelArg", referenced from:
      _sync_run_kernel in ccFuZYMI.o
    "_clEnqueueNDRangeKernel", referenced from:
      _sync_run_kernel in ccFuZYMI.o
    "_clEnqueueReadBuffer", referenced from:
      _sync_run_kernel in ccFuZYMI.o
    "_clReleaseContext", referenced from:
      _destroy_kernel in ccFuZYMI.o
    "_clReleaseCommandQueue", referenced from:
      _destroy_kernel in ccFuZYMI.o
    "_clReleaseMemObject", referenced from:
      _destroy_kernel in ccFuZYMI.o
    "_clReleaseProgram", referenced from:
      _destroy_kernel in ccFuZYMI.o
    "_clReleaseKernel", referenced from:
      _destroy_kernel in ccFuZYMI.o
  ld: symbol(s) not found for architecture x86_64
  </code></pre>
  
  <p>There are some other warnings, but no other errors at compulation stage. This is (in case not clear) a linker error. It seems to be able to see the definitions from the header file while creating the object file, because it gives me warnings about incompatible pointer types.</p>
  
  <p>I have tried pasting into an xcode project, but I get exactly the same errors. I have tried the <a href="https://apple.stackexchange.com/questions/21562/installing-imagemagick-leads-to-weird-error-involving-opencl">only other OS X Lion / OpenCL result's solution</a>, and it didn't help.</p>