从vs15更新到vs17之后出现660错误

时间:2017-06-16 10:55:48

标签: c++ visual-studio compiler-errors

我昨天换了一台新笔记本电脑,决定下载新的VS 2017社区。在我的旧笔记本电脑上,我使用了VS 2015 Enterprise。我有多个旧项目给我这些错误。我搜索的范围很广,但我能找到的唯一相关问题是:

Variable is not a type name error

错误的屏幕截图:

发生这种情况的示例项目:

Source.cpp:

#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"
#include <iostream>
#include <string>


using namespace cv;
using namespace std;

//Prototypes
int useFilter2D(int argc, char** argv);

int main(int argc, char** argv)
{
    useFilter2D(argc,argv);

    waitKey(0);
}

Mat image_canny, image_gray_canny;
Mat dst, detected_edges;

int edgeThresh = 1;
int lowThreshold;
int const max_lowThreshold = 100;
int ratio = 3;
int kernel_size = 3;
char* window_name = "Result";

void CannyThreshold(int, void*)
{
    /// Reduce noise with a kernel 3x3
    blur(image_gray_canny, detected_edges, Size(3, 3));

    /// Canny detector
    Canny(detected_edges, detected_edges, lowThreshold, lowThreshold*ratio, kernel_size);

    /// Using Canny's output as a mask, we display our result
    dst = Scalar::all(0);

    image_canny.copyTo(dst, detected_edges);
    imshow(window_name, dst);
}

int useFilter2D(int argc, char** argv)
{
    Mat src, src_gray;
    Mat grad;
    char* window_name = "Result Sobel";
    int scale = 1;
    int delta = 0;
    int ddepth = CV_16S;

    // Controle of er een argument aan het programma is meegegeven.
    if (argc != 2)
    {
        cout << " Usage: display_image ImageToLoadAndDisplay" << endl;
        return -1;
    }

    src = imread(argv[1], CV_LOAD_IMAGE_COLOR);

    // Controleer of alles goed is gegaan
    if (!src.data)
    {
        cout << "Could not open or find the image" << std::endl;
        return -1;
    }

    // Laat de afbeelding zien in een apart window
    namedWindow("Display window", WINDOW_AUTOSIZE);
    imshow("Display window", src);

    // convert to grey
    GaussianBlur(src, src, Size(3, 3), 0, 0, BORDER_DEFAULT);
    cvtColor(src, src_gray, CV_BGR2GRAY);

    // Create window 
    namedWindow(window_name, CV_WINDOW_AUTOSIZE);

    Mat grad_x, grad_y;
    Mat abs_grad_x, abs_grad_y;

    /// Gradient X
    Sobel(src_gray, grad_x, ddepth, 1, 0, 3, scale, delta, BORDER_DEFAULT);
    convertScaleAbs(grad_x, abs_grad_x);

    /// Gradient Y
    Sobel(src_gray, grad_y, ddepth, 0, 1, 3, scale, delta, BORDER_DEFAULT);
    convertScaleAbs(grad_y, abs_grad_y);

    /// Total Gradient (approximate)
    addWeighted(abs_grad_x, 0.5, abs_grad_y, 0.5, 0, grad);

    imshow(window_name, grad);

    waitKey(0);

    return 0;
}

1 个答案:

答案 0 :(得分:0)

从评论的更多猜测来看,这是一个解决方案:

图像中显示的错误不是编译器错误,但IntelliSense无法正确理解代码。尽管看起来很奇怪,但IntelliSense基于一个单独的编译器(by EDG),它并不总是与Visual C ++编译器完全同步。

如果您更改了最右边的下拉列表中的过滤器&#34; Build + IntelliSense&#34;到#34;仅建立&#34;错误,这些消息将消失。