title: Incorrectly including cloo in C#?
body: <p>I'm trying to get <strong><a href="http://dhruba.name/2012/10/14/opencl-cookbook-hello-world-using-c-cloo-host-binding/" rel="nofollow noreferrer">this</a></strong> demo to build but I get this error</p>
  
  <p><img src="https://i.stack.imgur.com/8SvYB.png" alt="enter image description here"></p>
  
  <p>I've tried this with mono and visual studio 2010, same problem</p>
  
  <p>The error occurs on line </p>
  
  <pre><code>program.Build(null, null, null, IntPtr.Zero);
  </code></pre>
  
  <p><strong>EDIT</strong></p>
  
  <p>C#</p>
  
  <pre><code>using System;
  using Cloo;
  using System.Collections.Concurrent;
  using System.Threading.Tasks;
  using System.IO;
  
  namespace ClooTest
  {
      class MainClass
      {
          public static void Main (string[] args)
          {
              // pick first platform
              ComputePlatform platform = ComputePlatform.Platforms[0];
  
              // create context with all gpu devices
              ComputeContext context = new ComputeContext(ComputeDeviceTypes.Gpu,
                                                          new ComputeContextPropertyList(platform), null, IntPtr.Zero);
  
              // create a command queue with first gpu found
              ComputeCommandQueue queue = new ComputeCommandQueue
              (
                  context,
                  context.Devices[0], 
                  ComputeCommandQueueFlags.None
              );
  
              // load opencl source
              StreamReader streamReader = new StreamReader("kernels.cl");
              string clSource = streamReader.ReadToEnd();
              streamReader.Close();
  
              // create program with opencl source
              ComputeProgram program = new ComputeProgram(context, clSource);
  
              // compile opencl source
              program.Build(null, null, null, IntPtr.Zero);
  
              // load chosen kernel from program
              ComputeKernel kernel = program.CreateKernel("helloWorld");
  
              // create a ten integer array and its length
              int[] message = new int[] { 1, 2, 3, 4, 5 };
              int messageSize = message.Length;
  
              // allocate a memory buffer with the message (the int array)
              ComputeBuffer&lt;int&gt; messageBuffer = new ComputeBuffer&lt;int&gt;(context,
                                                                        ComputeMemoryFlags.ReadOnly | ComputeMemoryFlags.UseHostPointer, message);
  
              kernel.SetMemoryArgument(0, messageBuffer); // set the integer array
              kernel.SetValueArgument(1, messageSize); // set the array size
  
              // execute kernel
              queue.ExecuteTask(kernel, null);
  
              // wait for completion
              queue.Finish();
          }
      }
  }
  </code></pre>
  
  <p>OpenCL</p>
  
  <pre><code>kernel void helloWorld(global read_only int* message, int messageSize) {
      for (int i = 0; i &lt; messageSize; i++) {
          printf("%d", message[i]);
      }
  }
  </code></pre>
  
  <p><strong>EDIT</strong>
  <img src="https://i.stack.imgur.com/tm5mr.png" alt="debug"></p>