Hadi GhahremanNezhad
Hadi GhahremanNezhad

Reputation: 2455

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

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:

enter image description here

Upvotes: 2

Views: 998

Answers (1)

Kevin
Kevin

Reputation: 18361

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.

Upvotes: 1

Related Questions