title: How to run a simple OpenCV code in C++ on linux?
body: <p>I wrote a simple OpenCV code using C++ and run it in linux:</p>
  <pre><code>#include &lt;iostream&gt;
  #include &lt;opencv2/opencv.hpp&gt;
  #include &lt;opencv2/highgui.hpp&gt;
  using namespace std;
  int main()
  {
      cv::Mat image;
      image = cv::imread(&quot;sajjad.jpg&quot;, 1);
   
      cv::namedWindow(&quot;Display Image&quot;, cv::WINDOW_AUTOSIZE);
      cv::imshow(&quot;Display Image&quot;, image);
      cv::waitKey(0);
      return 0;
  }
  </code></pre>
  <p>I get this error:</p>
  <pre><code>opencv_test.cpp:2:10: fatal error: opencv2/opencv.hpp: No such file or directory
   #include &lt;opencv2/opencv.hpp&gt;
            ^~~~~~~~~~~~~~~~~~~~
  compilation terminated.
  </code></pre>
  <p>how to install OpenCV for c++ in linux?</p>