title: Why can't I compile this command-line OpenCV Mac application?
body: <p>Following is my step:</p>
  
  <p>1)create a command line tool project "OpenCV"</p>
  
  <p>2)add files to the project which are in /usr/local/lib with suffix 2.4.2, such as 
  "libopencv_calib3d.2.4.2.dylib"</p>
  
  <p>3)add "/usr/local/include" to project's Header Search Path</p>
  
  <p>4)type this program:</p>
  
  <pre><code>#include &lt;opencv2/opencv.hpp&gt;
  #include &lt;opencv2/highgui/highgui.hpp&gt;
  #include &lt;opencv/cvaux.hpp&gt;
  
  int main(int argc, char** argv)
  {
      IplImage * pInpImg = 0;
  
      // Load an image from file - change this based on your image name
      pInpImg = cvLoadImage("my_image.jpg", CV_LOAD_IMAGE_UNCHANGED);
      if(!pInpImg)
      {
          fprintf(stderr, "failed to load input image\n");
          return -1;
      }
  
      // Write the image to a file with a different name,
      // using a different image format -- .png instead of .jpg
      if( !cvSaveImage("my_image_copy.png", pInpImg) )
      {
          fprintf(stderr, "failed to write image file\n");
      }
  
      // Remember to free image memory after using it!
      cvReleaseImage(&amp;pInpImg);
  
      return 0;
  }
  </code></pre>
  
  <p>However, I get error :</p>
  
  <pre><code>ld: library not found for -lopencv_calib3d.2.4.2
  clang: error: linker command failed with exit code 1 (use -v to see invocation)
  </code></pre>
  
  <p>Where is the problem?</p>
  
  <p>I'm using mountain lion and Xcode 4.4</p>