unresolved external symbol error when importing libraries for OpenCV2.3 in Visual Studios 2010 Express C++

后端 未结 6 1570
自闭症患者
自闭症患者 2020-11-30 09:12

first time posting a question here to stackoverflow. Sorry if I butcher the formatting!

I am attempting to follow a basic tutorial on openCV, namely this one: http:/

6条回答
  •  难免孤独
    2020-11-30 10:04

    I had a similar problem while I was trying to compile cvblob library (http://code.google.com/p/cvblob/) on Windows 7 32bit with Visual Studio 2010.

    If everything else is done properly try my guess written below. If not start with these tutorials:

    • Installing OpenCV: http://docs.opencv.org/trunk/doc/tutorials/introduction/windows_install/windows_install.html#cpptutwindowsmakeown
    • Configuring your projects to build and work with opencv: http://docs.opencv.org/trunk/doc/tutorials/introduction/windows_visual_studio_Opencv/windows_visual_studio_Opencv.html#windows-visual-studio-how-to.

      These silimar linker errors disappeared after changing some project properties:

      • In VS 2010 open Your solution
      • Open solution explorer (View->Solution Explorer)
      • Find a project that generated these linker errors. (In my example it was a project called "cvblob" inside solution called "cvBlob" generated by cmake.)
      • right click on that project
      • From the context menu select properties
      • On the left select Configuration properties -> General and find a field called "Target extension"
      • In Project Details find your project settings for "Configuration Type"
      • analyse them. In my particular problem of compiling cvblob I had to set Target extension to .lib and Configuration type to Static library. This is also a solution for guys trying to compile cvblob library in Visual Studio 2010. Do the same for Debug and Release version if needed.

    Errors I got were:

    Error 24 error LNK2019: unresolved external symbol _cvSetImageROI referenced in function _cvSetImageROItoBlob C:\cvblob\build\lib\cvblob.obj cvblob

    Error 25 error LNK2019: unresolved external symbol _cvSaveImage referenced in function _cvSaveImageBlob C:\cvblob\build\lib\cvblob.obj cvblob

    Error 26 error LNK2019: unresolved external symbol _cvGetImageROI referenced in function _cvSaveImageBlob C:\cvblob\build\lib\cvblob.obj cvblob

    Error 27 error LNK2001: unresolved external symbol _cvError C:\cvblob\build\lib\cvcolor.obj cvblob

    Error 28 error LNK2019: unresolved external symbol _cvError referenced in function _cvRenderBlob C:\cvblob\build\lib\cvblob.obj cvblob

    Error 29 error LNK2001: unresolved external symbol _cvError C:\cvblob\build\lib\cvlabel.obj cvblob

    Error 30 error LNK2001: unresolved external symbol _cvError C:\cvblob\build\lib\cvcontour.obj cvblob

    Error 31 error LNK2001: unresolved external symbol _cvError C:\cvblob\build\lib\cvtrack.obj cvblob

    Error 32 error LNK2019: unresolved external symbol _cvLine referenced in function _cvRenderBlob C:\cvblob\build\lib\cvblob.obj cvblob

    Error 33 error LNK2001: unresolved external symbol _cvLine C:\cvblob\build\lib\cvcontour.obj cvblob

    Error 34 error LNK2019: unresolved external symbol _cvRectangle referenced in function _cvRenderBlob C:\cvblob\build\lib\cvblob.obj cvblob

    Error 35 error LNK2001: unresolved external symbol _cvRectangle C:\cvblob\build\lib\cvtrack.obj cvblob

    Error 36 error LNK2019: unresolved external symbol _cvSetZero referenced in function _cvLabel C:\cvblob\build\lib\cvlabel.obj cvblob

    Error 37 error LNK2019: unresolved external symbol _cvPutText referenced in function _cvRenderTracks C:\cvblob\build\lib\cvtrack.obj cvblob

    Error 38 error LNK2019: unresolved external symbol _cvInitFont referenced in function _cvRenderTracks C:\cvblob\build\lib\cvtrack.obj cvblob

    Error 39 error LNK1120: 9 unresolved externals C:\cvblob\build\lib\libs\Release\cvblob.dll cvblob

    I hope it will help someone compiling cvblob library in visual studio 2010.

提交回复
热议问题