与Visual Studio一起使用Opencv_2.4.9时出现错误C1075?

时间:2014-11-08 15:57:42

标签: c++ visual-studio-2010 opencv

将openpc 2.4.9中的库与visual studio 2010链接后,我构建并运行了一个程序,并收到此错误消息。

error C1075: end of file found before the left brace '{'at ' c:\users\iggy\documents\visual studio 2010\projects\open_cv_test\open_cvtest\main.cpp(6)' was matched.


#include <opencv\cv.h>
#include <opencv\highgui.h>

using namespace cv;

int main(){
{
    IplImage* img = cvLoadImage("C:\\Users\\9589693153\\Desktop\\Vids\\sqlite.png"); //change the name(image.jpg) according to your Image filename.

    cvNamedWindow("Example1", CV_WINDOW_NORMAL);
    cvShowImage("Example1", img);

    cvWaitKey(0);
    cvReleaseImage(&img);

    cvDestroyWindow("Example1");

    return 0;
}

2 个答案:

答案 0 :(得分:2)

This error通常由不匹配的括号,大括号或其他配对角色引起。

对于您的情况,请删除额外的}

int main(){
          ^

答案 1 :(得分:0)

请停止使用已弃用的c-api,这是一个死胡同。

而是用c ++编写代码,

#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
using namespace cv;

int main() //{ <-- here's your excessive {, like herohuyongtao pointed out before
{
    Mat img = imread("C:\\Users\\9589693153\\Desktop\\Vids\\sqlite.png"); //change the name(image.jpg) according to your Image filename.

    namedWindow("Example1", CV_WINDOW_NORMAL);
    imshow("Example1", img);

    waitKey(0);
    return 0;
}