Linking errors for Qt and cvv when building OpenCV in Windows 10

|▌冷眼眸甩不掉的悲伤 提交于 2021-01-28 11:06:15

问题


I am trying to build OpenCV according to these instructions. After generating with CMake I opened OpenCV.sln in the build folder, switched to Release mode and built ALL_BUILD successfully. But when I try to build the INSTALL option under CMake, I get errors like this:

Error   LNK2001 unresolved external symbol "public: virtual struct QMetaObject const * __cdecl cvv::qtutil::Signal::metaObject(void)const " 
Error   LNK2019 unresolved external symbol "public: void __cdecl cvv::qtutil::ZoomableImage::updateConversionResult(class cv::Mat const &,enum cvv::qtutil::ImageConversionResult)const " 
...

I am installing OpenCV 4.2 on Windows 10 with Visual Studio 19. How can I solve this problem?

Here is an image of the error messages in Visual Studio:


回答1:


Turning my comments into an answer:

The GitHub issue described here references similar errors to those you have posted. While the suggested "solution" seems more like a work-around, it may help resolve the issue. First, try building without the cvv module (an interactive GUI component of OpenCV), by running CMake with the BUILD_opencv_cvv variable set to OFF:

cmake -DBUILD_opencv_cvv=OFF ...

You can also set the variable using the CMake GUI, by clicking the Add Entry button, and defining BUILD_opencv_cvv to OFF.

The GitHub issue further explains that if there are still undefined reference errors after making this change, you can also try setting BUILD_opencv_world to OFF as well.

cmake -DBUILD_opencv_cvv=OFF -DBUILD_opencv_world=OFF ...

This may help get things building successfully, but it should be noted that these disabled modules will be left out of your build.



来源:https://stackoverflow.com/questions/59753002/linking-errors-for-qt-and-cvv-when-building-opencv-in-windows-10

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!