Suddenly cannot compile opencv applications, windows 10

asked 2016-06-03 17:08:09 -0600

stillNovice gravatar image

I have been using openCv for a while, but have just moved to windows 10.

Now, existing applications will compile, but I cannot make a new one.

In a new project (visual studio 2015, release 64)

I am adding all the libs:

opencv_calib3d310.lib
opencv_core310.lib
opencv_features2d310.lib
opencv_flann310.lib
opencv_highgui310.lib
opencv_imgcodecs310.lib
opencv_imgproc310.lib
opencv_ml310.lib
opencv_objdetect310.lib
opencv_photo310.lib
opencv_shape310.lib
opencv_stitching310.lib
opencv_superres310.lib
opencv_ts310.lib
opencv_video310.lib
opencv_videoio310.lib
opencv_videostab310.lib

setting:

D:\opencv-master\build64\lib\Release;%(AdditionalLibraryDirectories)

and

D:\opencv-master\modules\highgui\include
D:\opencv-master\modules\imgcodecs\include
D:\opencv-master\modules\core\include
D:\opencv-master\modules\videoio\include
D:\opencv-master\modules\imgproc\include
%(AdditionalIncludeDirectories)

and adding the most basic:

#include <opencv2/core.hpp>
#include <opencv2/imgcodecs.hpp>
#include <opencv2/highgui.hpp>
#include "stdafx.h"
#include <iostream>

using namespace cv;
using namespace std;

int main(int argc, char** argv)
{
    if (argc != 2)
    {
        cout << " Usage: display_image ImageToLoadAndDisplay" << endl;
        return -1;
    }

    Mat image;
    image = imread(argv[1], IMREAD_COLOR); // Read the file

    if (image.empty()) // Check for invalid input
    {
        cout << "Could not open or find the image" << 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;
}

In visual studio, Intellisense is fine, no red underlines, everything looks good. When I try to compile tho...

'cv': a namespace with this name does not exist 
'Mat': undeclared identifier
'image': undeclared identifier

and many more. It is like it cannot find the libs, but i am linking them correctly, I am sure of it.

Can anyone assist me here?

edit retag flag offensive close merge delete

Comments

1

follow the instruction as my answer to a similar question

pklab gravatar imagepklab ( 2016-06-04 05:47:02 -0600 )edit