错误提示是这样的:
1>c:\program files\opencv1.2\include\opencv\highgui.hpp(54) : error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int
1>c:\program files\opencv1.2\include\opencv\highgui.hpp(54) : error C2143: 语法错误 : 缺少“,”(在“&”的前面)
1>c:\program files\opencv1.2\include\opencv\highgui.hpp(66) : error C2146: 语法错误 : 缺少“;”(在标识符“imread”的前面)
1>c:\program files\opencv1.2\include\opencv\highgui.hpp(66) : error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int
1>c:\program files\opencv1.2\include\opencv\highgui.hpp(66) : error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int
1>c:\program files\opencv1.2\include\opencv\highgui.hpp(67) : error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int
1>c:\program files\opencv1.2\include\opencv\highgui.hpp(67) : error C2143: 语法错误 : 缺少“,”(在“&”的前面)
1>c:\program files\opencv1.2\include\opencv\highgui.hpp(68) : error C2059: 语法错误 : “)”
1>c:\program files\opencv1.2\include\opencv\highgui.hpp(68) : error C2143: 语法错误 : 缺少“)”(在“;”的前面)
1>c:\program files\opencv1.2\include\opencv\highgui.hpp(69) : error C2146: 语法错误 : 缺少“;”(在标识符“imdecode”的前面)
1>c:\program files\opencv1.2\include\opencv\highgui.hpp(69) : error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int
1>c:\program files\opencv1.2\include\opencv\highgui.hpp(69) : error C2086: “int cv::Mat”: 重定义
1> c:\program files\opencv1.2\include\opencv\highgui.hpp(66) : 参见“cv::Mat”的声明
1>c:\program files\opencv1.2\include\opencv\highgui.hpp(69) : error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int
1>c:\program files\opencv1.2\include\opencv\highgui.hpp(69) : error C2143: 语法错误 : 缺少“,”(在“&”的前面)
1>c:\program files\opencv1.2\include\opencv\highgui.hpp(69) : error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int
1>c:\program files\opencv1.2\include\opencv\highgui.hpp(70) : error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int
1>c:\program files\opencv1.2\include\opencv\highgui.hpp(70) : error C2143: 语法错误 : 缺少“,”(在“&”的前面)
1>c:\program files\opencv1.2\include\opencv\highgui.hpp(72) : error C2059: 语法错误 : “)”
1>c:\program files\opencv1.2\include\opencv\highgui.hpp(72) : error C2143: 语法错误 : 缺少“)”(在“;”的前面)
1>c:\program files\opencv1.2\include\opencv\highgui.hpp(78) : error C2143: 语法错误 : 缺少“;”(在“<”的前面)
1>c:\program files\opencv1.2\include\opencv\highgui.hpp(78) : error C2182: “Ptr”: 非法使用“void”类型
1>c:\program files\opencv1.2\include\opencv\highgui.hpp(78) : error C2433: “Ptr”: 不允许在数据声明中使用“inline”
1>c:\program files\opencv1.2\include\opencv\highgui.hpp(78) : error C2988: 不可识别的模板声明/定义
1>c:\program files\opencv1.2\include\opencv\highgui.hpp(78) : error C2059: 语法错误 : “<”
1>c:\program files\opencv1.2\include\opencv\highgui.hpp(78) : error C2039: “delete_obj”: 不是“`global namespace'”的成员
1>c:\program files\opencv1.2\include\opencv\highgui.hpp(81) : error C2039: “delete_obj”: 不是“`global namespace'”的成员
1>c:\program files\opencv1.2\include\opencv\highgui.hpp(82) : error C2143: 语法错误 : 缺少“;”(在“{”的前面)
1>c:\program files\opencv1.2\include\opencv\highgui.hpp(82) : error C2447: “{”: 缺少函数标题(是否是老式的形式表?)
1>c:\program files\opencv1.2\include\opencv\highgui.hpp(126) : fatal error C1506: 无法恢复的块范围错误我使用的是opencv1.2版
我的编译环境是2008,设置如下:
工具->选项->项目和解决方案->VC++目录->包含文件,添加了:C:\Program Files\OpenCV1.2\include\opencv
工具->选项->项目和解决方案->VC++目录->库文件,添加了:C:\Program Files\OpenCV1.2\lib
工具->选项->项目和解决方案->VC++目录->源文件,添加了:
C:\Program Files\OpenCV1.2\src\cv
C:\Program Files\OpenCV1.2\src\cvaux\vs
C:\Program Files\OpenCV1.2\src\cxcore
C:\Program Files\OpenCV1.2\src\highgui
C:\Program Files\OpenCV1.2\src\ml并且在新建的项目的属性->链接->输入->依赖附加项中,添加以下库文件:
cv120.lib
cvaux120.lib
cxcore120.lib
cxts120.lib
highgui120.lib
ml120.lib另外,我的工程是已经写好的,其中依赖附加项中包含了cv110d.lib,cvaux110d.lib,cxcore110d.lib
1.0版和1.2版是否会有冲突呢?
我在工程中引用highgui.h就会报错,为什么?