title: Where/how to place build files in OpenCV
body: <p>I'm just getting started with OpenCV, and I have the following sample .cpp file (from opencv.org):</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;opencv2/opencv.hpp&gt;
  
  using namespace cv;
  
  int main( int argc, char** argv )
  {
      Mat image;
      image = imread( argv[1], 1 );
  
      if( argc != 2 || !image.data )
      {
          printf( "No image data \n" );
          return -1;
      }
  
      namedWindow( "Display Image", CV_WINDOW_AUTOSIZE );
      imshow( "Display Image", image );
  
      waitKey(0);
  
      return 0;
  }
  </code></pre>
  
  <p>and I have the following CMakeList.cmake file:</p>
  
  <pre><code>project(opencvTEST)
  cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
  
  find_package(OpenCV REQUIRED)
  
  # Project Executable
  add_executable (test test.cpp)
  target_link_libraries(test ${OpenCV_LIBS})
  </code></pre>
  
  <p>I have a Mac (OS 10.6.8), and I've installed OpenCV 2.4.3 with CMake, and I've searched high and low and tried numerous different things to get this test program to compile (I'm using the command line--no IDE), but I get the following compilation error (clearly, due to the <code>include</code> statement's not working properly):</p>
  
  <pre><code>test.cpp:3:30: error: opencv2/opencv.hpp: No such file or directory
  test.cpp:5: error: ‘cv’ is not a namespace-name
  test.cpp:5: error: expected namespace-name before ‘;’ token
  test.cpp: In function ‘int main(int, char**)’:
  test.cpp:9: error: ‘Mat’ was not declared in this scope
  test.cpp:9: error: expected `;' before ‘image’
  test.cpp:10: error: ‘image’ was not declared in this scope
  test.cpp:10: error: ‘imread’ was not declared in this scope
  test.cpp:18: error: ‘CV_WINDOW_AUTOSIZE’ was not declared in this scope
  test.cpp:18: error: ‘namedWindow’ was not declared in this scope
  test.cpp:19: error: ‘imshow’ was not declared in this scope
  test.cpp:21: error: ‘waitKey’ was not declared in this scope
  </code></pre>
  
  <p>I have a folder named <code>opencv2</code> in the same directory as <code>test.cpp</code>, and <code>opencv.hpp</code> is in <code>opencv2</code>, so I don't understand why it's not finding it.  Any ideas?  </p>
  
  <p>Also, in general, where does OpenCV expect you to put your source (.cpp, etc.) files?</p>