VS uses Opecv and its points of attention

VS uses Opecv

  1. 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.)
    insert image description hereinsert image description here

  2. 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

  1. Before running the program, you need to choose releaseor debugmode (depending on which one you have configured), choose X64or X86(depending on the number of digits of your computer)
  2. If you want to run successfully releasein debugany mode (for example, in this case: it is normal under release and an error occurs under debug LNK2019 无法解析的外部符号 void __cdecl cv::imshow ...), you need to 属性页—>链接器—>输入—>附加依赖性add opencv_world430.liband opencv_world430d.lib(where 430 depends on the version number of the downloaded opencv, for example, the download needs to opencv-4.5.5-vc14_vc15.exebe written as opencv_world455.liband opencv_world455d.lib; among them The one dwith is the corresponding debugmode, the one without dis used for releasethe mode)
    insert image description here
    insert image description here

insert image description hereinsert image description here

wrong reflection

  1. LNK error
    严重性 代码 说明 项目 文件 行 禁止显示状态 错误 LNK1120 1 个无法解析的外部命令 testopencv E:\03_Program\VS_Opencv\testopencv\x64\Debug\testopencv.exe 1  
    
    Considerations: 1. The library file is not added ( 属性页—>链接器—>输入—>附加依赖性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

  1. There are errors under release and under debug (use of opencv): https://blog.csdn.net/gainichengyichongfu/article/details/107137652
  2. error LNK1120: 1 unresolved external command: https://blog.csdn.net/qing101hua/article/details/52234644

Guess you like

Origin blog.csdn.net/weixin_43686259/article/details/128994431