OpenCV-contrib: Reference to unresolved external symbol

asked 2020-07-28 14:43:10 -0500

Hi, I would like to use a function of OpenCV-contrib. I added the header-files to the include folder of OpenCV on my PC but I didn’t linked them. OpenCV standard functions work well. That’s the reason why I didn’t use CMake to build the library (like this: https://cv-tricks.com/how-to/installa...).

Now I get the error: LNK2019 – Reference to unresolved external symbol. (#include <opencv2 ximgproc.hpp=""> is possible without getting an error)

Is there a possibility to link the manually added header to the library? I use Microsoft Visual Studio and C++.

edit retag flag offensive close merge delete

Comments

can you try again, and get us the exact errror msg `?

(it's a linker error, nothing to do with including headers)

seeing your code might also be helpful to estimate, which is the problematic module used

berak gravatar imageberak ( 2020-07-28 15:40:07 -0500 )edit

The exact error is: Reference to unresolved external symbol ""void __cdecl cv::ximgproc::fourierDescriptor(class cv::debug_build_guard::_InputArray const &,class cv::debug_build_guard::_OutputArray const &,int,int)" (?fourierDescriptor@ximgproc@cv@@YAXAEBV_InputArray@debug_build_guard@2@AEBV_OutputArray@42@HH@Z)" in Funktion "main".

lukas168 gravatar imagelukas168 ( 2020-07-29 01:33:13 -0500 )edit

you'll have to add opencv_ximgproc440d.lib (or whatever opencv version you got) to your library list.

berak gravatar imageberak ( 2020-07-29 01:54:27 -0500 )edit

And where do I get this opencv_ximgproc440d.liib library from? In the download folder of OpenCV contrib wasn't that library included?

lukas168 gravatar imagelukas168 ( 2020-07-29 02:46:20 -0500 )edit

oh dear, you have to rebuild the opencv libs before you can use it

(what you downloaded is only the src, no binaries)

berak gravatar imageberak ( 2020-07-29 02:51:03 -0500 )edit