Search code examples
c++visual-c++visual-studio-2008opencvapplication-settings

Fatal error in starting up OpenCV 2.4.6 on VS 2008, file not found


I am using this tutorial to get started with OpenCV 2.4.6 on VS 2008: http://docs.opencv.org/doc/tutorials/introduction/windows_visual_studio_Opencv/windows_visual_studio_Opencv.html

I followed all instructions (my OpenCV is not in the default Program Files (x86) folder, it's in

C:\opencv_built

Unlike in the tutorial, I put very simple code, just to make sure all included files are reachable and if it builds successfully etc:

#include "stdafx.h"

#include <iostream> // for standard I/O
#include <string>   // for strings
#include <iomanip>  // for controlling float print precision
#include <sstream>  // string to number conversion

#include <opencv2/imgproc/imgproc.hpp>  // Gaussian Blur
#include <opencv2/core/core.hpp>        // Basic OpenCV structures (cv::Mat, Scalar)
#include <opencv2/highgui/highgui.hpp>  // OpenCV window I/O
using namespace std;
using namespace cv;

double getPSNR ( const Mat& I1, const Mat& I2);
Scalar getMSSIM( const Mat& I1, const Mat& I2);


int main(int argc, char *argv[])
{
    return 0;
}

But I get a fatal error when I try to build:

fatal error C1083: Cannot open include file: 'opencv2/imgproc/imgproc.hpp': No such file or directory   c:\Users\Administrator\Documents\Visual Studio 2008\Projects\firstopencv\firstopencv\firstopencv.cpp    17  

This is obviously referring to this line:

#include <opencv2/imgproc/imgproc.hpp>  // Gaussian Blur

I don't know where to find the dll files, or what to do next? I know this must be really easy but I've searched for any of the dll files, eg.

opencv_core243d.lib

but I get no search results.


Solution

  • Okay the fix was this:

    Under Linker -> General -> Additional Library Dependencies

    I put:

    C:\opencv_built\lib\Debug