Microsoft Visual Studio中配置OpenCV解决方案属性的时候, 需要将OpenCV的lib扩展名的库文件添加到属性的依赖列表里面,网上的有些人博客里面直接给出的会有问题(但大多数是好的),自己动手丰衣足食,开始:
1、要读取文件名字的文件夹位置如下,我们要记住: D:\opencv\build\install\x64\vc12\lib
2、然后打开系统的命令行(不需要管理员权限):
命令行显示当前处于C:\Users\HooS目录下。
然后在命令行界面输入:
1
dir D:\opencv\build\install\x64\vc12\lib\*.lib /b > note1.txt
其实格式就是" dir 格式1 /b > 格式2 "。
格式1: 指明去哪里找什么样的文件名字。 假如格式一是" *.lib "的话就是在当前路径下找所有lib扩展名的文件; 假如格式一是" * "的话就是找当前路径下所有文件和文件夹的名字; 扩展一下," D:\opencv\build\install\x64\vc12\lib\*.lib "只是换了个绝对路径而已, 找的是那个文件夹下面的所有lib扩展名的文件的名字。格式2:指明保存到哪里 " note1.txt "表明将那些名字保存到当前目录下的note1.txt文本文件里, 而相应的我们可以指定保存到某个指定位置:" d:\note1.txt "就是保存到D盘根目录下的note1.txt文件里面。
然后就生成了文本文件:(生成位置在C:\Users\HooS(HooS是我的用户名)下面)
生成的文件内容如下:
<wiz_code_mirror>
1
opencv_calib3d2413.lib
2
opencv_calib3d2413d.lib
3
opencv_contrib2413.lib
4
opencv_contrib2413d.lib
5
opencv_core2413.lib
6
opencv_core2413d.lib
7
opencv_features2d2413.lib
8
opencv_features2d2413d.lib
9
opencv_flann2413.lib
10
opencv_flann2413d.lib
11
opencv_gpu2413.lib
12
opencv_gpu2413d.lib
13
opencv_highgui2413.lib
14
opencv_highgui2413d.lib
15
opencv_imgproc2413.lib
16
opencv_imgproc2413d.lib
17
opencv_legacy2413.lib
18
opencv_legacy2413d.lib
19
opencv_ml2413.lib
20
opencv_ml2413d.lib
21
opencv_nonfree2413.lib
22
opencv_nonfree2413d.lib
23
opencv_objdetect2413.lib
24
opencv_objdetect2413d.lib
25
opencv_ocl2413.lib
26
opencv_ocl2413d.lib
27
opencv_photo2413.lib
28
opencv_photo2413d.lib
29
opencv_stitching2413.lib
30
opencv_stitching2413d.lib
31
opencv_superres2413.lib
32
opencv_superres2413d.lib
33
opencv_ts2413.lib
34
opencv_ts2413d.lib
35
opencv_video2413.lib
36
opencv_video2413d.lib
37
opencv_videostab2413.lib
38
opencv_videostab2413d.lib
39
假如想要保存的名字是绝对路径,那么修改下即可:
1
dir D:\opencv\build\install\x64\vc12\lib\*.lib /b/s > note2.txt
生成的note2.txt内容如下:
<wiz_code_mirror>
1
D:\opencv\build\install\x64\vc12\lib\opencv_calib3d2413.lib
2
D:\opencv\build\install\x64\vc12\lib\opencv_calib3d2413d.lib
3
D:\opencv\build\install\x64\vc12\lib\opencv_contrib2413.lib
4
D:\opencv\build\install\x64\vc12\lib\opencv_contrib2413d.lib
5
D:\opencv\build\install\x64\vc12\lib\opencv_core2413.lib
6
D:\opencv\build\install\x64\vc12\lib\opencv_core2413d.lib
7
D:\opencv\build\install\x64\vc12\lib\opencv_features2d2413.lib
8
D:\opencv\build\install\x64\vc12\lib\opencv_features2d2413d.lib
9
D:\opencv\build\install\x64\vc12\lib\opencv_flann2413.lib
10
D:\opencv\build\install\x64\vc12\lib\opencv_flann2413d.lib
11
D:\opencv\build\install\x64\vc12\lib\opencv_gpu2413.lib
12
D:\opencv\build\install\x64\vc12\lib\opencv_gpu2413d.lib
13
D:\opencv\build\install\x64\vc12\lib\opencv_highgui2413.lib
14
D:\opencv\build\install\x64\vc12\lib\opencv_highgui2413d.lib
15
D:\opencv\build\install\x64\vc12\lib\opencv_imgproc2413.lib
16
D:\opencv\build\install\x64\vc12\lib\opencv_imgproc2413d.lib
17
D:\opencv\build\install\x64\vc12\lib\opencv_legacy2413.lib
18
D:\opencv\build\install\x64\vc12\lib\opencv_legacy2413d.lib
19
D:\opencv\build\install\x64\vc12\lib\opencv_ml2413.lib
20
D:\opencv\build\install\x64\vc12\lib\opencv_ml2413d.lib
21
D:\opencv\build\install\x64\vc12\lib\opencv_nonfree2413.lib
22
D:\opencv\build\install\x64\vc12\lib\opencv_nonfree2413d.lib
23
D:\opencv\build\install\x64\vc12\lib\opencv_objdetect2413.lib
24
D:\opencv\build\install\x64\vc12\lib\opencv_objdetect2413d.lib
25
D:\opencv\build\install\x64\vc12\lib\opencv_ocl2413.lib
26
D:\opencv\build\install\x64\vc12\lib\opencv_ocl2413d.lib
27
D:\opencv\build\install\x64\vc12\lib\opencv_photo2413.lib
28
D:\opencv\build\install\x64\vc12\lib\opencv_photo2413d.lib
29
D:\opencv\build\install\x64\vc12\lib\opencv_stitching2413.lib
30
D:\opencv\build\install\x64\vc12\lib\opencv_stitching2413d.lib
31
D:\opencv\build\install\x64\vc12\lib\opencv_superres2413.lib
32
D:\opencv\build\install\x64\vc12\lib\opencv_superres2413d.lib
33
D:\opencv\build\install\x64\vc12\lib\opencv_ts2413.lib
34
D:\opencv\build\install\x64\vc12\lib\opencv_ts2413d.lib
35
D:\opencv\build\install\x64\vc12\lib\opencv_video2413.lib
36
D:\opencv\build\install\x64\vc12\lib\opencv_video2413d.lib
37
D:\opencv\build\install\x64\vc12\lib\opencv_videostab2413.lib
38
D:\opencv\build\install\x64\vc12\lib\opencv_videostab2413d.lib
39