本文为cherish总结,这里先收藏着了啦啦啦!!!
vs中配置时尽量在全局配置中修改,否则每次新建项目都需要重新配置
全局配置步骤如下:
1.“视图”菜单 -> (其他窗口->)属性管理器 -> Debug | win32 -> Microsoft.Cpp.Win32.user (双击)
其中下面的【E:\Program Files\OpenCV】为安装目录,【2.3.0】是opencv版本,其他版本配置修改为对应的
2.vc++目录->包含目录:(cb中为:搜索路径->编译器)
E:\Program Files\OpenCV\2.3.0\OpenCV\build\include\opencv
E:\Program Files\OpenCV\2.3.0\OpenCV\build\include
3.vc++目录->库目录(cb中为:链接器 ):
E:\Program Files\OpenCV\2.3.0\OpenCV\build\x86\mingw\lib
【注:这里根据版本不同,可能没有mingw文件夹,此时可根据具体环境选择其他对应库,如x86\vc10\lib】
4.链接器->输入:
(cb中为:链接器设置->链接库,并定位到E:\Program Files\OpenCV\2.3.0\OpenCV\build\x86\vc9\lib...)
附加依赖项:
opencv_calib3d230.lib
opencv_contrib230.lib
opencv_core230.lib
opencv_features2d230.lib
opencv_flann230.lib
opencv_gpu230.lib
opencv_haartraining_engine.lib
opencv_highgui230.lib
opencv_imgproc230.lib
opencv_legacy230.lib
opencv_ml230.lib
opencv_objdetect230.lib
opencv_video230.lib
5.设置系统环境变量:
在系统变量Path后面加上【;E:\Program Files\OpenCV\2.4.9\opencv\build\x86\vc10\bin;】注意是英文的分号
opencv_calib3d244d.lib
opencv_contrib244d.lib
opencv_core244d.lib
opencv_features2d244d.lib
opencv_flann244d.lib
opencv_gpu244d.lib
opencv_highgui244d.lib
opencv_imgproc244d.lib
opencv_legacy244d.lib
opencv_ml244d.lib
opencv_nonfree244d.lib
opencv_objdetect244d.lib
opencv_photo244d.lib
opencv_stitching244d.lib
opencv_ts244d.lib
opencv_video244d.lib
opencv_videostab244d.lib