I got an Error Code LNK2019

asked 2020-06-29 22:11:40 -0600

bkkuan gravatar image

updated 2020-06-30 04:37:56 -0600

berak gravatar image

I got an error code LNK2019 when building Opencv using ALL_BUILD in visual studio 2017. Can i know how to solve this error?

error LNK2019: unresolved external symbol __imp__H5open referenced in function "public: __thiscall cv::hdf::HDF5Impl::HDF5Impl(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (??0HDF5Impl@hdf@cv@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)

error LNK2019: unresolved external symbol __imp__H5check_version referenced in function "public: __thiscall cv::hdf::HDF5Impl::HDF5Impl(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (??0HDF5Impl@hdf@cv@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)

error LNK2019: unresolved external symbol __imp__H5Tcreate referenced in function "public: virtual void __thiscall cv::hdf::HDF5Impl::kpcreate(int,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,int,int)const " (?kpcreate@HDF5Impl@hdf@cv@@UBEXHABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@HH@Z)
edit retag flag offensive close merge delete

Comments

which version of libhdf5 do you have ?

have a look here

maybe you'll find, that you don't need the hdf module at all, in this case you could disable it by adding

-D BUILD_opencv_hdf=OFF

to your cmake cmdline

berak gravatar imageberak ( 2020-06-30 03:12:24 -0600 )edit

I am unsure of this hdf? I dont think i have it in my pc.

bkkuan gravatar imagebkkuan ( 2020-06-30 03:18:09 -0600 )edit

it must have found hdf5 headers, else cmake would have excluded it from the build

again, find out if you need hdf support (ppl rarely do ..), if not so, disable it, rerun cmake.

berak gravatar imageberak ( 2020-06-30 03:22:35 -0600 )edit
1

i am using cmake-gui and i do not have the option BUILD_opencv_hdf

bkkuan gravatar imagebkkuan ( 2020-06-30 03:31:17 -0600 )edit

what, you don't ??? o_O

please add the cmake output to your question (yes it's long, but we neeed all of it !)

berak gravatar imageberak ( 2020-06-30 03:36:08 -0600 )edit

i remove hdf but now another error appears C:\Users\bryan\anaconda3\libs\python37.lib : warning LNK4272: library machine type 'x86' conflicts with target machine type 'x64' 109>D:\OpenCV\build\lib\python3\Release\cv2.cp37-win_amd64.pyd : fatal error LNK1120: 77 unresolved externals

bkkuan gravatar imagebkkuan ( 2020-06-30 05:21:37 -0600 )edit

anaconda

ahhhhhrrrrgggg. that's where it likely found the botched hdf5 version

library machine type 'x86' conflicts with target machine type 'x64'

you're either need to build 64bit opencv libs or reinstall a 32bit python version

also note, that you can only build python bindings in RELEASE mode, since there is no debug python lib

berak gravatar imageberak ( 2020-06-30 05:47:28 -0600 )edit

my python is 32 bit. 3.7

bkkuan gravatar imagebkkuan ( 2020-06-30 09:33:09 -0600 )edit