VS uses Opecv
-
Opencv download link: https://opencv.org/releases/ (official website); https://download.csdn.net/download/weixin_43686259/87442252 (I downloaded the window version of OpenCV from the official website – 4.7.0, OpenCV – 4.5.5, opencv-4.3.0; no points required; opencv here can be compiled by double-clicking, but it serves vs, I tried to make it serve vscode failed.)
-
Installation logic
Installation reference link: https://blog.csdn.net/qq_41175905/article/details/80560429 (VS2017 configuration opencv tutorial); https://blog.csdn.net/Creama_/article/details/107238475 (VS2019+ OpenCV installation and configuration tutorial)- Double click to install
- Configure environment variables
- Copy the .dll file under the bin file to C:\Windows\SysWOW64 (to prevent the error that the .dll cannot be reported)
- Configure the property manager in VS (three places: ①-
vc++目录—>包含目录
; ②-vc++目录—>库目录
; ③-属性页—>链接器—>输入—>附加依赖性
.)
points of attention
- Before running the program, you need to choose
release
ordebug
mode (depending on which one you have configured), chooseX64
orX86
(depending on the number of digits of your computer) - If you want to run successfully
release
indebug
any mode (for example, in this case: it is normal under release and an error occurs under debugLNK2019 无法解析的外部符号 void __cdecl cv::imshow ...
), you need to属性页—>链接器—>输入—>附加依赖性
addopencv_world430.lib
andopencv_world430d.lib
(where 430 depends on the version number of the downloaded opencv, for example, the download needs toopencv-4.5.5-vc14_vc15.exe
be written asopencv_world455.lib
andopencv_world455d.lib
; among them The oned
with is the correspondingdebug
mode, the one withoutd
is used forrelease
the mode)
wrong reflection
- LNK error
Considerations: 1. The library file is not added (严重性 代码 说明 项目 文件 行 禁止显示状态 错误 LNK1120 1 个无法解析的外部命令 testopencv E:\03_Program\VS_Opencv\testopencv\x64\Debug\testopencv.exe 1
属性页—>链接器—>输入—>附加依赖性
adding the library file); whether the declaration and implementation of the function are both used, and whether the location is correct (the declaration of the function is placed in the header file, and the implementation of the function is placed in the .cpp file)
reference
- There are errors under release and under debug (use of opencv): https://blog.csdn.net/gainichengyichongfu/article/details/107137652
- error LNK1120: 1 unresolved external command: https://blog.csdn.net/qing101hua/article/details/52234644