c++visual-studioopencvlnk2019unresolved-external

LNK2019 unresolved external symbol cvCreateImage referenced in function main


I tried to build a code snippet in my MS VS Codes 2022 community version. I configured all the needed things to use the functionalities in OpenCV. But, I'm getting a set of errors. The configurations I have done are mentioned below. enter image description here

enter image description here

enter image description here

enter image description here Error:

Error   LNK1120 7 unresolved externals  Project1    D:\L4S1\DIP\Labs\Lab2\Project1\x64\Debug\Project1.exe   1   
Error   LNK2019 unresolved external symbol cvWaitKey referenced in function main    Project1    D:\L4S1\DIP\Labs\Lab2\Project1\Project1\Lab1.obj    1   
Error   LNK2019 unresolved external symbol cvDestroyWindow referenced in function main  Project1    D:\L4S1\DIP\Labs\Lab2\Project1\Project1\Lab1.obj    1   
Error   LNK2019 unresolved external symbol cvShowImage referenced in function main  Project1    D:\L4S1\DIP\Labs\Lab2\Project1\Project1\Lab1.obj    1   
Error   LNK2019 unresolved external symbol cvNamedWindow referenced in function main    Project1    D:\L4S1\DIP\Labs\Lab2\Project1\Project1\Lab1.obj    1   
Error   LNK2019 unresolved external symbol cvLoadImage referenced in function main  Project1    D:\L4S1\DIP\Labs\Lab2\Project1\Project1\Lab1.obj    1   
Error   LNK2019 unresolved external symbol cvReleaseImage referenced in function main   Project1    D:\L4S1\DIP\Labs\Lab2\Project1\Project1\Lab1.obj    1   
Error   LNK2019 unresolved external symbol cvCreateImage referenced in function main    Project1    D:\L4S1\DIP\Labs\Lab2\Project1\Project1\Lab1.obj    1

Solution

  • When doing the configurations under Linker I have done a mistake. When the configuration is in Debug status, need to add the opencv_world3413d.lib under the input field. In my above-posted question, I have put it under General in the Linker section. The corrected configuration should be as below,

    enter image description here