title: Problem with running c++ opencv program in linux: functions not declared
body: <p>I'm learning OpenCV and I'm using c++.
  I installed opencv in my ubuntu using the libopencv-dev and python3-opencv packegs in ubuntu 20.04 from this tutorial: <a href="https://linuxize.com/post/how-to-install-opencv-on-ubuntu-20-04/" rel="nofollow noreferrer">https://linuxize.com/post/how-to-install-opencv-on-ubuntu-20-04/</a>
  but when I try to run a sample program using this command <code>g++ -I/usr/local/include/opencv4 Example1.cpp -o Example1</code> I get this error:</p>
  <pre><code>Example1.cpp: In function ‘int main(int, char**)’:
  
  Example1.cpp:5:2: error: ‘IplImage’ was not declared in this scope
  
      5 |  IplImage* img = cvLoadImage( argv[1] );
        |  ^~~~~~~~
  
  Example1.cpp:5:12: error: ‘img’ was not declared in this scope
  
      5 |  IplImage* img = cvLoadImage( argv[1] );
        |            ^~~
  
  Example1.cpp:5:18: error: ‘cvLoadImage’ was not declared in this scope
  
      5 |  IplImage* img = cvLoadImage( argv[1] );
        |                  ^~~~~~~~~~~
  
  Example1.cpp:6:29: error: ‘CV_WINDOW_AUTOSIZED’ was not declared in this scope
  
      6 |  cvNamedWindow( &quot;Example1&quot;, CV_WINDOW_AUTOSIZED );
        |                             ^~~~~~~~~~~~~~~~~~~
  
  Example1.cpp:6:2: error: ‘cvNamedWindow’ was not declared in this scope
  
      6 |  cvNamedWindow( &quot;Example1&quot;, CV_WINDOW_AUTOSIZED );
        |  ^~~~~~~~~~~~~
  
  Example1.cpp:7:2: error: ‘cvShowImage’ was not declared in this scope
  
      7 |  cvShowImage( &quot;Example1&quot;, img );
        |  ^~~~~~~~~~~
  
  Example1.cpp:8:2: error: ‘cvWaitKey’ was not declared in this scope
  
      8 |  cvWaitKey(0);
        |  ^~~~~~~~~
  
  Example1.cpp:9:2: error: ‘cvReleaseImage’ was not declared in this scope
  
      9 |  cvReleaseImage( &amp;img );
        |  ^~~~~~~~~~~~~~
  
  Example1.cpp:10:2: error: ‘cvDestroyWindow’ was not declared in this scope
  
      10 |  cvDestroyWindow( &quot;Example1&quot; );
         |  ^~~~~~~~~~~~~~~
  </code></pre>
  <p>here is the source code:</p>
  <pre><code>#include &lt;opencv2/highgui.h&gt;
  
  int main( int argc, char** argv ) {
  
      IplImage* img = cvLoadImage( argv[1] );
      cvNamedWindow( &quot;Example1&quot;, CV_WINDOW_AUTOSIZED );
      cvShowImage( &quot;Example1&quot;, img );
      cvWaitKey(0);
      cvReleaseImage( &amp;img );
      cvDestroyWindow( &quot;Example1&quot; );
  
  }
  </code></pre>
  <p>and the pkg-config output(if it's needed):</p>
  <p><strong>p4n0@p4n0-desktop:~/Desktop/Example_Project$ pkg-config --cflags opencv</strong></p>
  <p>-I/usr/local/include/opencv4</p>
  <p><strong>p4n0@p4n0-desktop:~/Desktop/Example_Project$ pkg-config --libs opencv</strong></p>
  <p>-L/usr/local/lib -lopencv_gapi -lopencv_stitching -lopencv_alphamat -lopencv_aruco -lopencv_bgsegm -lopencv_bioinspired -lopencv_ccalib -lopencv_dnn_objdetect -lopencv_dnn_superres -lopencv_dpm -lopencv_highgui -lopencv_face -lopencv_freetype -lopencv_fuzzy -lopencv_hfs -lopencv_img_hash -lopencv_intensity_transform -lopencv_line_descriptor -lopencv_mcc -lopencv_quality -lopencv_rapid -lopencv_reg -lopencv_rgbd -lopencv_saliency -lopencv_stereo -lopencv_structured_light -lopencv_phase_unwrapping -lopencv_superres -lopencv_optflow -lopencv_surface_matching -lopencv_tracking -lopencv_datasets -lopencv_text -lopencv_dnn -lopencv_plot -lopencv_videostab -lopencv_videoio -lopencv_xfeatures2d -lopencv_shape -lopencv_ml -lopencv_ximgproc -lopencv_video -lopencv_xobjdetect -lopencv_objdetect -lopencv_calib3d -lopencv_imgcodecs -lopencv_features2d -lopencv_flann -lopencv_xphoto -lopencv_photo -lopencv_imgproc -lopencv_core</p>