title: libopencv_core.so.2.4: error adding symbols: DSO missing from command line
body: <p>I have installed OpenCV 3.3.0 to Ubuntu 16.04. Just want to compile this code.</p>
  
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  #include "opencv2/opencv.hpp"
  #include "opencv2/gpu/gpu.hpp"
  #include &lt;opencv2/opencv.hpp&gt;
  #include &lt;opencv2/imgproc/imgproc.hpp&gt;
  #include &lt;cmath&gt;
  
  using namespace cv;
  
  int main(int argc, char* argv[])
  {
      try
      {
          int kernel_size = 3;
          cv::Mat src_host = cv::imread("crack2.jpg");
          cv::Mat gray_img, avg, kernel;
          cv::gpu::GpuMat dst, src;
          src.upload(src_host);
  
          cv::gpu::threshold(src, dst, 128.0, 255.0, CV_THRESH_BINARY);
  
          cv::Mat result_host;
          dst.download(result_host);
  
          std::cout&lt;&lt; "Done!!!" &lt;&lt;std::endl;
  
      }catch(const cv::Exception&amp; ex)
      {
          std::cout&lt;&lt;"Error: " &lt;&lt; ex.what() &lt;&lt; std::endl;
      }
      return 0;
  }
  </code></pre>
  
  <p>g++ -o main gpu_thresh.cpp 'pkg-config opencv --cflags --libs' -lopencv_gpu -lopencv_core</p>
  
  <p>g++ -L/usr/local/lib -o main gpu_thresh.cpp 'pkg-config opencv --cflags --libs' -lopencv_gpu -lopencv_core</p>
  
  <p>I tried to compile it with these ways but still giving same warning and error.</p>
  
  <blockquote>
    <p>/usr/bin/ld: warning: libopencv_core.so.2.4, needed by
    /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libopencv_gpu.so,
    may conflict with libopencv_core.so.3.3 /usr/bin/ld: /tmp/ccdhLGL0.o:
    undefined reference to symbol '_ZN2cv3gpu6GpuMat7releaseEv'
    //usr/lib/x86_64-linux-gnu/libopencv_core.so.2.4: error adding
    symbols: DSO missing from command line collect2: error: ld returned 1
    exit status</p>
  </blockquote>
  
  <p>What should I do? </p>