2011-03-07 4 views
1

나는 Learning OpenCV 책에서 다음 프로그램을 입력 한 :OpenCV - 왜이 빌드 오류가 있습니까?

#include "highgui.h" 

int main(int argc, char *argv[]) 
{ 
    IplImage *img = cvLoadImage(argv[1]); 
    cvNamedWindow("Example1", CV_WINDOW_AUTOSIZE); 
    cvShowImage("Example1", img); 
    cvWaitKey(0); 
    cvReleaseImage(&img); 
    cvDestroyWindow("Example1"); 
} 

난 다음 내가 얻을 Eclipse CDT을 사용하여 구축하려고하면 (어떤 아이디어?) :

**** Build of configuration Debug for project OpenCV **** 

**** Internal Builder is used for build    **** 
g++ -IC:\OpenCV2.0\include\opencv -O0 -g3 -Wall -c -fmessage-length=0 -osrc\opencv.o ..\src\opencv.cpp 
In file included from C:/OpenCV2.0/include/opencv/cxcore.hpp:2243, 
       from C:/OpenCV2.0/include/opencv/cxcore.h:2123, 
       from C:/OpenCV2.0/include/opencv/highgui.h:47, 
       from ..\src\opencv.cpp:1: 
C:/OpenCV2.0/include/opencv/cxoperations.hpp: In member function `void cv::Ptr<_Tp>::addref()': 
C:/OpenCV2.0/include/opencv/cxoperations.hpp:1442: error: there are no arguments to `__exchange_and_add' that depend on a template parameter, so a declaration of `__exchange_and_add' must be available 
C:/OpenCV2.0/include/opencv/cxoperations.hpp:1442: error: (if you use `-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated) 
C:/OpenCV2.0/include/opencv/cxoperations.hpp: In member function `void cv::Ptr<_Tp>::release()': 
C:/OpenCV2.0/include/opencv/cxoperations.hpp:1446: error: there are no arguments to `__exchange_and_add' that depend on a template parameter, so a declaration of `__exchange_and_add' must be available 
C:/OpenCV2.0/include/opencv/cxoperations.hpp: In member function `cv::Ptr<_Tp>& cv::Ptr<_Tp>::operator=(const cv::Ptr<_Tp>&)': 
C:/OpenCV2.0/include/opencv/cxoperations.hpp:1473: error: there are no arguments to `__exchange_and_add' that depend on a template parameter, so a declaration of `__exchange_and_add' must be available 
In file included from C:/OpenCV2.0/include/opencv/cxcore.hpp:2244, 
       from C:/OpenCV2.0/include/opencv/cxcore.h:2123, 
       from C:/OpenCV2.0/include/opencv/highgui.h:47, 
       from ..\src\opencv.cpp:1: 
C:/OpenCV2.0/include/opencv/cxmat.hpp: In copy constructor `cv::Mat::Mat(const cv::Mat&)': 
C:/OpenCV2.0/include/opencv/cxmat.hpp:102: error: `__exchange_and_add' was not declared in this scope 
C:/OpenCV2.0/include/opencv/cxmat.hpp:102: warning: unused variable '__exchange_and_add' 
C:/OpenCV2.0/include/opencv/cxmat.hpp: In constructor `cv::Mat::Mat(const cv::Mat&, const cv::Range&, const cv::Range&)': 
C:/OpenCV2.0/include/opencv/cxmat.hpp:174: error: `__exchange_and_add' was not declared in this scope 
C:/OpenCV2.0/include/opencv/cxmat.hpp:174: warning: unused variable '__exchange_and_add' 
C:/OpenCV2.0/include/opencv/cxmat.hpp: In constructor `cv::Mat::Mat(const cv::Mat&, const cv::Rect&)': 
C:/OpenCV2.0/include/opencv/cxmat.hpp:189: error: `__exchange_and_add' was not declared in this scope 
C:/OpenCV2.0/include/opencv/cxmat.hpp:189: warning: unused variable '__exchange_and_add' 
C:/OpenCV2.0/include/opencv/cxmat.hpp: In member function `cv::Mat& cv::Mat::operator=(const cv::Mat&)': 
C:/OpenCV2.0/include/opencv/cxmat.hpp:239: error: `__exchange_and_add' was not declared in this scope 
C:/OpenCV2.0/include/opencv/cxmat.hpp:239: warning: unused variable '__exchange_and_add' 
C:/OpenCV2.0/include/opencv/cxmat.hpp: In member function `void cv::Mat::addref()': 
C:/OpenCV2.0/include/opencv/cxmat.hpp:342: error: `__exchange_and_add' was not declared in this scope 
C:/OpenCV2.0/include/opencv/cxmat.hpp:342: warning: unused variable '__exchange_and_add' 
C:/OpenCV2.0/include/opencv/cxmat.hpp: In member function `void cv::Mat::release()': 
C:/OpenCV2.0/include/opencv/cxmat.hpp:346: error: `__exchange_and_add' was not declared in this scope 
C:/OpenCV2.0/include/opencv/cxmat.hpp:346: warning: unused variable '__exchange_and_add' 
C:/OpenCV2.0/include/opencv/cxmat.hpp: In copy constructor `cv::MatND::MatND(const cv::MatND&)': 
C:/OpenCV2.0/include/opencv/cxmat.hpp:3648: error: `__exchange_and_add' was not declared in this scope 
C:/OpenCV2.0/include/opencv/cxmat.hpp:3648: warning: unused variable '__exchange_and_add' 
C:/OpenCV2.0/include/opencv/cxmat.hpp: In member function `cv::MatND& cv::MatND::operator=(const cv::MatND&)': 
C:/OpenCV2.0/include/opencv/cxmat.hpp:3677: error: `__exchange_and_add' was not declared in this scope 
C:/OpenCV2.0/include/opencv/cxmat.hpp:3677: warning: unused variable '__exchange_and_add' 
C:/OpenCV2.0/include/opencv/cxmat.hpp: In member function `void cv::MatND::addref()': 
C:/OpenCV2.0/include/opencv/cxmat.hpp:3717: error: `__exchange_and_add' was not declared in this scope 
C:/OpenCV2.0/include/opencv/cxmat.hpp:3717: warning: unused variable '__exchange_and_add' 
C:/OpenCV2.0/include/opencv/cxmat.hpp: In member function `void cv::MatND::release()': 
C:/OpenCV2.0/include/opencv/cxmat.hpp:3722: error: `__exchange_and_add' was not declared in this scope 
C:/OpenCV2.0/include/opencv/cxmat.hpp:3722: warning: unused variable '__exchange_and_add' 
C:/OpenCV2.0/include/opencv/cxmat.hpp: In member function `cv::SparseMat& cv::SparseMat::operator=(const cv::SparseMat&)': 
C:/OpenCV2.0/include/opencv/cxmat.hpp:4081: error: `__exchange_and_add' was not declared in this scope 
C:/OpenCV2.0/include/opencv/cxmat.hpp:4081: warning: unused variable '__exchange_and_add' 
C:/OpenCV2.0/include/opencv/cxmat.hpp: In member function `void cv::SparseMat::addref()': 
C:/OpenCV2.0/include/opencv/cxmat.hpp:4112: error: `__exchange_and_add' was not declared in this scope 
C:/OpenCV2.0/include/opencv/cxmat.hpp:4112: warning: unused variable '__exchange_and_add' 
C:/OpenCV2.0/include/opencv/cxmat.hpp: In member function `void cv::SparseMat::release()': 
C:/OpenCV2.0/include/opencv/cxmat.hpp:4116: error: `__exchange_and_add' was not declared in this scope 
C:/OpenCV2.0/include/opencv/cxmat.hpp:4116: warning: unused variable '__exchange_and_add' 
Build error occurred, build is stopped 
Time consumed: 28061 ms. 

감사합니다.

답변

0

OpenCV 디자이너보다 최신 컴파일러를 사용하고 있으므로 템플릿 규칙 위반을보고합니다. 또한, 만약 당신이 -fpermissive를 사용한다면 덜 엄격 할 것이고 예전의 컴파일러와 비슷하다고 말합니다.

빠른 인터넷 검색 결과 또한 OpenCV 2.1이 있음을 보여줍니다. 아마도 그 중 하나가 더 효과가 있을까요?

+0

현재 버전은'OpenCV 2.2'입니다. – Simplicity

+0

그래, 내 인터넷 검색은 ** 조금 빠릅니다. :-) 나는 최신 컴파일러가 있다면 그 버전을 시도했을 것이다. –

관련 문제