2011-08-08 55 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」。