简体   繁体   中英

Error in simple OpenCv c++ program CodeBlock window 7

When I try running the below c++ program in codeBlock on windows 7 I am getting the following error.

"\\test_opencv\\main.cpp -o obj\\Debug\\main.o C:\\Users\\Root\\Desktop\\test_opencv\\main.cpp: In function 'int main(int, char**)': C:\\Users\\Root\\Desktop\\test_opencv\\main.cpp:13: error: 'cvNameWindow' was not declared in this scope Process terminated with status 1 (0 minutes, 1 seconds) 1 errors, 0 warnings"

=============================================================== program

#include "cv.h"
#include "highgui.h"
#include "cvwimage.h"
#include <iostream>

using namespace std;

int main(int argc,char** argv)
{
    IplImage *pImg;
    cout << "Hello world!" << endl;
    if(argc==2 && (pImg=cvLoadImage(argv[1],1))!=0)
    {
        cvNameWindow("Image",1);
        cvShowImage("Image",pImg);
        cvWaitKey(0);
        cvDestroyWindow("Image");
        cvReleaseImage(&pImg);
        return 0;
    }
    return -1;
}

===================================== I have followed the steps given in this link to set up the opencv and codeBlock. http://opensourcecollection.blogspot.com/2011/04/how-to-setup-opencv-22-in-codeblocks.html .

What could be the problem?

I guess you mistyped. You wrote "cvNameWindow" instead of "cvNamedWindow".

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM