title: OpenCV Tutorial: Load and Display an Image (codeblocks, fedora20)
body: <p>I successfully installed and linked and included OpenCV. (I know it was successful because I compiled and ran the opencv program <a href="http://opencv.blogspot.com/2005/03/my-first-opencv-program.html" rel="noreferrer">found on this site</a>)</p>
  
  <p>So I went back to the OpenCV documentation and tutorials pages. I copied <a href="http://docs.opencv.org/doc/tutorials/introduction/display_image/display_image.html" rel="noreferrer">from this page</a> the exact code below. </p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;opencv2/core/core.hpp&gt;
  #include &lt;opencv2/highgui/highgui.hpp&gt;
  
  using namespace cv;
  using namespace std;
  
  int main(int argc, char** argv)
  {
      if( argc != 2)
      {
          cout &lt;&lt;" Usage: display_image ImageToLoadAndDisplay" &lt;&lt; endl;
          return -1;
      }
  
      Mat image;
      image = imread(argv[1], CV_LOAD_IMAGE_COLOR);   // Read the file
  
      if(!image.data )                              // Check for invalid input
      {
          cout &lt;&lt;  "Could not open or find the image" &lt;&lt; std::endl ;
          return -1;
      }
  
      namedWindow( "Display window", WINDOW_AUTOSIZE );// Create a window for display.
      imshow( "Display window", image );                   // Show our image inside it.
  
      waitKey(0);                                          // Wait for a keystroke in the window
      return 0;
  }
  //This is the end
  </code></pre>
  
  <p>(Running codeblocks on fedora20)
  Using Project >> Set programs' arguments I fed in "/home/Kennedy/Pictures/enterprise.bmp" without the quotes.</p>
  
  <p>Since I'm using a bmp file (<a href="http://docs.opencv.org/modules/highgui/doc/reading_and_writing_images_and_video.html#imread" rel="noreferrer">supported</a>), and the file path is correct, can anyone suggest why codeblocks is spitting out </p>
  
  <pre><code>/home/Kennedy/Documents/workspace/OpenCVtest/main.cpp|21|error: ‘CV_LOAD_IMAGE_COLOR’ was not declared in this scope|
  </code></pre>
  
  <p>instead of running a lovely little first program?</p>
  
  <p>For reference, I've read but not found help on <a href="https://stackoverflow.com/questions/19923463/opencv-imread-not-found-or-imread-not-return-value-imreadargv1-cv-load-ima">this</a>, <a href="http://docs.opencv.org/modules/highgui/doc/reading_and_writing_images_and_video.html#imread" rel="noreferrer">this</a>, and other Q&amp;As on stackoverflow, codeblocks forum, and anywhere else I could think to look. I also saw <a href="http://answers.opencv.org/question/25827/cv_load_image_color-not-defined-in-this-scope/" rel="noreferrer">this</a>, but I'm not having a problem with WINDOW_AUTOSIZE.</p>
  
  <p>EDIT TO ADD ANOTHER ATTEMPTED SOLUTION:
  I copied and pasted enterprise.bmp to the folder containing the project, removed the arguments, and replaced argv<a href="http://opencv.blogspot.com/2005/03/my-first-opencv-program.html" rel="noreferrer">1</a> with "enterprise.bmp".  This had no effect, I still get the same error.</p>