在Visual Studio下报错fatal error C1083: Cannot open include file: 'cv.h': No such file or directory
发布网友
发布时间:2023-07-22 16:05
我来回答
共1个回答
热心网友
时间:2023-09-21 12:17
不知道你安装OpenCV没有,没有就需要安装,安装后见如下操作:
在VS的项目设置中添加openCV的头文件路径。还有,设置这些引用等。
菜单Tools->Options->Directories:先设置lib路径,选择Library files,在下方填入路径:
C:\Program Files\OpenCV\lib
然后选择include files,在下方填入路径:
C:\Program Files\OpenCV\cxcore\include
C:\Program Files\OpenCV\cv\include
C:\Program Files\OpenCV\cvaux\include
C:\Program Files\OpenCV\ml\include
C:\Program Files\OpenCV\otherlibs\highgui
C:\Program Files\OpenCV\otherlibs\cvcam\include
然后选择source files,在下方填入路径:
C:\Program Files\OpenCV\cv\src
C:\Program Files\OpenCV\cxcore\src
C:\Program Files\OpenCV\cvaux\src
C:\Program Files\OpenCV\otherlibs\highgui
C:\Program Files\OpenCV\otherlibs\cvcam\src\windows
项目设置
每创建一个将要使用OpenCV的VC Project,都需要给它指定需要的lib。菜单:Project->Settings,然后将Setting for选为All Configurations,然后选择右边的link标签,在Object/library moles附加上
cxcore.lib cv.lib ml.lib cvaux.lib highgui.lib cvcam.lib