title: Compiling a basic OpenCV + Cuda program on linux
body: <p>I've worked with opencv on linux in the past, but not with cuda. I've struggled with the following compilation error for months. And  after trying many solutions i gave up and worked with windows. However, i really want to work on linux. This is the command i'm using to compile the threshold example given on the opencv_gpu website. </p>
  
  <pre><code>nvcc `pkg-config --libs opencv` -L. -L/usr/local/cuda/lib -lcuda -lcudart `pkg-config --cflags opencv` -I. -I/usr/local/cuda/include threshold.cpp -o threshold
  </code></pre>
  
  <p>here is the error:</p>
  
  <pre><code>/tmp/tmpxft_0000171b_00000000-1_threshold.o: In function `main':
  threshold.cpp:(.text+0x124): undefined reference to `cv::gpu::Stream::Null()'
  threshold.cpp:(.text+0x156): undefined reference to `cv::gpu::threshold(cv::gpu::GpuMat const&amp;, cv::gpu::GpuMat&amp;, double, double, int, cv::gpu::Stream&amp;)'
  threshold.cpp:(.text+0x16d): undefined reference to `cv::gpu::GpuMat::download(cv::Mat&amp;) const'
  /tmp/tmpxft_0000171b_00000000-1_threshold.o: In function `cv::gpu::GpuMat::GpuMat(cv::Mat const&amp;)':
  threshold.cpp:(.text._ZN2cv3gpu6GpuMatC1ERKNS_3MatE[cv::gpu::GpuMat::GpuMat(cv::Mat const&amp;)]+0x63): undefined reference to `cv::gpu::GpuMat::upload(cv::Mat const&amp;)'
  /tmp/tmpxft_0000171b_00000000-1_threshold.o: In function `cv::gpu::GpuMat::~GpuMat()':
  threshold.cpp:(.text._ZN2cv3gpu6GpuMatD1Ev[cv::gpu::GpuMat::~GpuMat()]+0xd): undefined reference to `cv::gpu::GpuMat::release()'                                        
  collect2: ld returned 1 exit status                                                                                                                                     
  make: *** [all] Error 1   
  </code></pre>