title: Error compiling CUDA
body: <p>I'm trying to compile a C program to try parallel programming, when I try to compile it with nvcc compiler (Nvidia) it gives me those errors:</p>
  
  <pre><code>inicis.cu(3): error: attribute "global" does not apply here
  
  inicis.cu(3): error: incomplete type is not allowed
  
  inicis.cu(3): error: identifier "a" is undefined
  
  inicis.cu(3): error: expected a ")"
  
  inicis.cu(4): error: expected a ";"
  
  /usr/include/_locale.h(68): error: expected a declaration
  
  inicis.cu(20): error: type name is not allowed
  
  inicis.cu(21): error: type name is not allowed
  
  inicis.cu(22): error: type name is not allowed
  
  inicis.cu(41): error: identifier "dev_a" is undefined
  
  inicis.cu(42): error: identifier "dev_b" is undefined
  
  inicis.cu(43): error: identifier "dev_c" is undefined
  </code></pre>
  
  <p>It seems nvcc doesn't recognize the <strong>global</strong> attribute made by Nvidia...</p>
  
  <p>Here's my C program, it's pretty simple:</p>
  
  <pre><code>__global__ void operate(*memoria1, *memoria2)
  {
      memoria2[threadIdx.x] = memoria1[threadIdx.x] + 1;
  }
  
  
  int main(int args, char **argv){
  
      int a[5], c[5];
      int *memory_1, *memory_2;
  
      cudaMalloc(void** &amp;memory_1, 5 * sizeof(int));
      cudaMalloc(void** &amp;memory_2, 5 * sizeof(int));
  
      cudaMemcpy(memory_1, a, 5 * sizeof(int), cudaMemcpyHostToDevice);
      cudaMemcpy(memory_2, c, 5 * sizeof(int), cudaMemcpyHostToDevice);
  
      operate &lt;&lt;&lt;1, 5&gt;&gt;&gt;(memory_1, memory_2);
  
      cudaMemcpy(c, memory_2, 5 * sizeof(int), cudaMemcpyDeviceToHost);
  
      for (int i = 0; i &lt; sizeof(c); ++i)
      {
          printf ("%d" , c[i]);
      }
  
      cudaFree(memory_1);
      cudaFree(memory_2);
  
      return 0;
  }
  </code></pre>
  
  <p>I think it could be the compiler but what do you think It would be?</p>