title: Visual Studio 2012 - OpenCV Link Error in Release Mode
body: <p>I am using OpenCV 2.4.5 with a Visual C++ project in the Visual Studio 2012 IDE. My project works correctly in <strong>DEBUG</strong> mode, but in <strong>RELEASE</strong> mode, I get the following compile error:</p>
  
  <blockquote>
    <p>error LNK1181: cannot open input file 'opencv_core245.lib'</p>
  </blockquote>
  
  <p>I then installed OpenCV and set up the environment variables as follows:</p>
  
  <blockquote>
    <ol>
    <li>Created the following System Variable: <strong>OPENCV_BUILD</strong> with the path C:\opencv\build\</li>
    <li>Added the following to the <strong>Path</strong> variable: C:\opencv\build\x86\vc11\bin</li>
    </ol>
  </blockquote>
  
  <p>Then, in Visual Studio 2012, I created a new property sheet for the debug mode as follows:</p>
  
  <blockquote>
    <p>Clicked <strong>View</strong> >> <strong>Property Manager</strong>
    Right clicked <strong>Debug</strong> >> <strong>Add New Project Property Sheet</strong></p>
  </blockquote>
  
  <p>I then edited the property sheet as follows:</p>
  
  <blockquote>
    <p><strong>C/C++ >> General >> Additional Include Directories:</strong> $(OPENCV_BUILD)\include;%(AdditionalIncludeDirectories)</p>
    
    <p><strong>Linker >> General >> Additional Library Directories:</strong> $(OPENCV_BUILD)\x86\vc11\lib;%(AdditionalLibraryDirectories)</p>
    
    <p><strong>Linker >> Input >> Additional Dependencies:</strong> opencv_core245d.lib;opencv_imgproc245d.lib;opencv_highgui245d.lib;opencv_ml245d.lib;opencv_video245d.lib;opencv_features2d245d.lib;opencv_calib3d245d.lib;opencv_objdetect245d.lib;opencv_contrib245d.lib;opencv_legacy245d.lib;opencv_flann245d.lib;%(AdditionalDependencies)</p>
  </blockquote>
  
  <p>I followed the same procedure to create a new property sheet for the release mode (I also followed the same procedure for editing the project properties), but for 
  <strong>Linker >> Input >> Additional Dependencies</strong> I omitted the "d" from each .lib filename (for example opencv_core245.lib instead of opencv_core245d.lib).</p>
  
  <p>In my code, I usually include the files as follows:
  <code>#include &lt;opencv2\highgui\highgui.hpp&gt;</code></p>
  
  <p>As I mention earlier, everything works fine in DEBUG mode, but in RELEASE mode I get the following compile error:</p>
  
  <blockquote>
    <p>error LNK1181: cannot open input file 'opencv_core245.lib'</p>
  </blockquote>
  
  <p>I've read so many other posts on this forum, but nothing seems to work. Can someone please help me, I am really desperate.</p>