2011-08-08 27 views
0

当我尝试在windows 7上运行codeBlock下面的c + +程序时出现以下错误。错误在简单的OpenCv c + +程序CodeBlock窗口7

"\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"

=========================================== ==================== 程序

#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; 
} 

===================== ================ 我已按照此链接中给出的步骤设置了opencv和codeBlock。 http://opensourcecollection.blogspot.com/2011/04/how-to-setup-opencv-22-in-codeblocks.html

可能是什么问题?

回答

2

我想你错了。你写了“cvNameWindow”而不是“cvNamedWindow”。