title: CUDA and gcc compatibility issue
body: <p>I was getting this error</p>
  
  <blockquote>
    <p>/usr/local/cuda-5.0/bin/../include/host_config.h:82:2: error: #error
    -- unsupported GNU version! gcc 4.7 and up are not supported! make: <em>*</em> [src/Throughput.o] Error 1</p>
  </blockquote>
  
  <p>In the host_config.h they assure compatibility up to the 4.6</p>
  
  <pre><code>#if __GNUC__ &gt; 4 || (__GNUC__ == 4 &amp;&amp; __GNUC_MINOR__ &gt; 6)
  
  #error -- unsupported GNU version! gcc 4.7 and up are not supported!
  </code></pre>
  
  <p>I have both 4.6 and 4.7</p>
  
  <blockquote>
    <p>elect@elect-desktop:/usr/local/cuda-5.0/bin$ gcc gcc<br>
    gcc-4.7         gcc-nm-4.7       gcc-4.6         gcc-ar-4.7<br>
    gcc-ranlib-4.7</p>
  </blockquote>
  
  <p>Looking on internet they suggest to add a link to the gcc-4.6 in the cuda bin directory.</p>
  
  <p>So I did</p>
  
  <blockquote>
    <p>elect@elect-desktop:/usr/local/cuda-5.0/bin$ sudo ln -s /usr/bin/gcc-4.6 gcc</p>
  </blockquote>
  
  <p>And I get another error</p>
  
  <pre><code>**** Build of configuration Debug for project Throughput ****
  
  make all 
  Building file: ../src/Throughput.cu
  Invoking: NVCC Compiler
  nvcc -G -g -O0 -gencode arch=compute_20,code=sm_20 -odir "src" -M -o "src/Throughput.d"     "../src/Throughput.cu"
  gcc: error trying to exec 'cc1plus': execvp: No such file or directory
  make: *** [src/Throughput.o] Error 1
  
  **** Build Finished ****
  </code></pre>
  
  <p>Googling again didn't bring me on some clear situations (gcc downgrading, etc)</p>
  
  <p>So I am asking here what is now the problem since CUDA is supposed to be compatible with gcc-4.6 ...</p>
  
  <p>My system:</p>
  
  <ul>
  <li>Ubuntu 12.10 64b</li>
  <li>cuda_5.0.35_linux_64_ubuntu11.10-1</li>
  </ul>
  
  <p>This is the tutorial code I am trying to compile at the moment</p>
  
  <pre><code>/**
   * Copyright 1993-2012 NVIDIA Corporation.  All rights reserved.
   *
   * Please refer to the NVIDIA end user license agreement (EULA) associated
   * with this source code for terms and conditions that govern your use of
   * this software. Any use, reproduction, disclosure, or distribution of
   * this software and related documentation outside the terms of the EULA
   * is strictly prohibited.
   */
  #include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  
  static const int WORK_SIZE = 256;
  
  /**
   * This macro checks return value of the CUDA runtime call and exits
   * the application if the call failed.
   */
  #define CUDA_CHECK_RETURN(value) {                                          \
      cudaError_t _m_cudaStat = value;                                        \
      if (_m_cudaStat != cudaSuccess) {                                       \
          fprintf(stderr, "Error %s at line %d in file %s\n",                 \
                  cudaGetErrorString(_m_cudaStat), __LINE__, __FILE__);       \
          exit(1);                                                            \
      } }
  
  __device__ unsigned int bitreverse(unsigned int number) {
      number = ((0xf0f0f0f0 &amp; number) &gt;&gt; 4) | ((0x0f0f0f0f &amp; number) &lt;&lt; 4);
      number = ((0xcccccccc &amp; number) &gt;&gt; 2) | ((0x33333333 &amp; number) &lt;&lt; 2);
      number = ((0xaaaaaaaa &amp; number) &gt;&gt; 1) | ((0x55555555 &amp; number) &lt;&lt; 1);
      return number;
  }
  
  /**
   * CUDA kernel function that reverses the order of bits in each element of the array.
   */
  __global__ void bitreverse(void *data) {
      unsigned int *idata = (unsigned int*) data;
      idata[threadIdx.x] = bitreverse(idata[threadIdx.x]);
  }
  
  /**
   * Host function that prepares data array and passes it to the CUDA kernel.
   */
  int main(void) {
      void *d = NULL;
      int i;
      unsigned int idata[WORK_SIZE], odata[WORK_SIZE];
  
      for (i = 0; i &lt; WORK_SIZE; i++)
          idata[i] = (unsigned int) i;
  
      CUDA_CHECK_RETURN(cudaMalloc((void**) &amp;d, sizeof(int) * WORK_SIZE));
  
      CUDA_CHECK_RETURN(cudaMemcpy(d, idata, sizeof(int) * WORK_SIZE, cudaMemcpyHostToDevice));
  
      bitreverse&lt;&lt;&lt;1, WORK_SIZE, WORK_SIZE * sizeof(int)&gt;&gt;&gt;(d);
  
      CUDA_CHECK_RETURN(cudaThreadSynchronize());
      // Wait for the GPU launched work to complete
      CUDA_CHECK_RETURN(cudaGetLastError());
      CUDA_CHECK_RETURN(cudaMemcpy(odata, d, sizeof(int) * WORK_SIZE, cudaMemcpyDeviceToHost));
  
      for (i = 0; i &lt; WORK_SIZE; i++)
          printf("Input value: %u, device output: %u\n", idata[i], odata[i]);
  
      CUDA_CHECK_RETURN(cudaFree((void*) d));
      CUDA_CHECK_RETURN(cudaDeviceReset());
  
      return 0;
  }
  </code></pre>