title: CUDA: Error while compiling my first cuda program
body: <p>I am very new to CUDA programming.. I wrote my first code and when I compiled it, it is showing me a lots of error. Can anyone tell me what is wrong</p>
  
  <p>the code</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include "cuda.h"
  #include &lt;stdlib.h&gt;
  
  __global__ void kernel(void) {
  }
  
  int main(int argc, char *argv[])
  {
          kernel&lt;&lt;&lt;1,1&gt;&gt;&gt;();
          printf("finished \n");
          return 0;
  }
  </code></pre>
  
  <p>The errors are</p>
  
  <pre><code>cuda.c:5: error: expected â=â, â,â, â;â, âasmâ or â__attribute__â before âvoidâ
  cuda.c:7: error: expected â=â, â,â, â;â, âasmâ or â__attribute__â before âvoidâ
  cuda.c: In function âmainâ:
  cuda.c:12: error: âkernelâ undeclared (first use in this function)
  cuda.c:12: error: (Each undeclared identifier is reported only once
  cuda.c:12: error: for each function it appears in.)
  cuda.c:12: error: expected expression before â&lt;â token
  </code></pre>
  
  <p>I compiled using </p>
  
  <blockquote>
    <p>nvcc cuda.c</p>
  </blockquote>
  
  <p>Can anyone tell me what mistake I am making....</p>