matio 找不到 HDF5 库

matio can't find HDF5 libraries

我正在尝试在 Ubuntu 机器上编译我的代码。我运行以下代码:

g++ refine_pascal_v4/dense_inference.cpp -o prog_refine_pascal_v4 -W -Wall -O2 -L. -lDenseCRF -lmatio -I./util/

我收到以下错误:

/usr/local/lib/libmatio.so: undefined reference to 

`H5P_CLS_FILE_CREATE_g'
//usr/local/lib/libmatio.so: undefined reference to `H5T_NATIVE_SHORT_g'
//usr/local/lib/libmatio.so: undefined reference to `H5Pcreate'
//usr/local/lib/libmatio.so: undefined reference to `H5Tcopy'
//usr/local/lib/libmatio.so: undefined reference to `H5Aget_space'
//usr/local/lib/libmatio.so: undefined reference to `H5Sget_simple_extent_dims'
//usr/local/lib/libmatio.so: undefined reference to `H5Eset_auto2'
//usr/local/lib/libmatio.so: undefined reference to `H5Sget_simple_extent_ndims'
//usr/local/lib/libmatio.so: undefined reference to `H5Aget_type'
//usr/local/lib/libmatio.so: undefined reference to `H5Fcreate'
//usr/local/lib/libmatio.so: undefined reference to `H5Sclose'
//usr/local/lib/libmatio.so: undefined reference to `H5Rcreate'
//usr/local/lib/libmatio.so: undefined reference to `H5T_NATIVE_SCHAR_g'
//usr/local/lib/libmatio.so: undefined reference to `H5Aopen_name'
//usr/local/lib/libmatio.so: undefined reference to `H5Tget_class'
//usr/local/lib/libmatio.so: undefined reference to `H5Acreate2'
//usr/local/lib/libmatio.so: undefined reference to `H5Aclose'
//usr/local/lib/libmatio.so: undefined reference to `H5T_NATIVE_ULONG_g'
//usr/local/lib/libmatio.so: undefined reference to `H5Pset_deflate'
//usr/local/lib/libmatio.so: undefined reference to `H5T_C_S1_g'
//usr/local/lib/libmatio.so: undefined reference to `H5Dopen2'
//usr/local/lib/libmatio.so: undefined reference to `H5Iget_type'
//usr/local/lib/libmatio.so: undefined reference to `H5Dget_type'
//usr/local/lib/libmatio.so: undefined reference to `H5T_NATIVE_FLOAT_g'
//usr/local/lib/libmatio.so: undefined reference to `H5Dwrite'
//usr/local/lib/libmatio.so: undefined reference to `H5T_NATIVE_HSIZE_g'
//usr/local/lib/libmatio.so: undefined reference to `H5Screate_simple'
//usr/local/lib/libmatio.so: undefined reference to `H5Aread'
//usr/local/lib/libmatio.so: undefined reference to `H5check_version'
//usr/local/lib/libmatio.so: undefined reference to `H5Iget_name'
//usr/local/lib/libmatio.so: undefined reference to `H5Gcreate2'
//usr/local/lib/libmatio.so: undefined reference to `H5Tget_size'
//usr/local/lib/libmatio.so: undefined reference to `H5Gget_objname_by_idx'
//usr/local/lib/libmatio.so: undefined reference to `H5Tvlen_create'
//usr/local/lib/libmatio.so: undefined reference to `H5T_NATIVE_UCHAR_g'
//usr/local/lib/libmatio.so: undefined reference to `H5Eget_auto2'
//usr/local/lib/libmatio.so: undefined reference to `H5Screate'
//usr/local/lib/libmatio.so: undefined reference to `H5Sselect_elements'
//usr/local/lib/libmatio.so: undefined reference to `H5Gopen2'
//usr/local/lib/libmatio.so: undefined reference to `H5Gget_objtype_by_idx'
//usr/local/lib/libmatio.so: undefined reference to `H5Dget_space'
//usr/local/lib/libmatio.so: undefined reference to `H5Dclose'
//usr/local/lib/libmatio.so: undefined reference to `H5Eprint1'
//usr/local/lib/libmatio.so: undefined reference to `H5T_NATIVE_LONG_g'
//usr/local/lib/libmatio.so: undefined reference to `H5Pset_userblock'
//usr/local/lib/libmatio.so: undefined reference to `H5Pclose'
//usr/local/lib/libmatio.so: undefined reference to `H5T_NATIVE_UINT_g'
//usr/local/lib/libmatio.so: undefined reference to `H5Tinsert'
//usr/local/lib/libmatio.so: undefined reference to `H5Rdereference'
//usr/local/lib/libmatio.so: undefined reference to `H5Sselect_hyperslab'
//usr/local/lib/libmatio.so: undefined reference to `H5T_NATIVE_INT_g'
//usr/local/lib/libmatio.so: undefined reference to `H5Gclose'
//usr/local/lib/libmatio.so: undefined reference to `H5Iinc_ref'
//usr/local/lib/libmatio.so: undefined reference to `H5Awrite'
//usr/local/lib/libmatio.so: undefined reference to `H5open'
//usr/local/lib/libmatio.so: undefined reference to `H5Dread'
//usr/local/lib/libmatio.so: undefined reference to `H5Tcreate'
//usr/local/lib/libmatio.so: undefined reference to `H5Gget_num_objs'
//usr/local/lib/libmatio.so: undefined reference to `H5Tset_size'
//usr/local/lib/libmatio.so: undefined reference to `H5P_CLS_DATASET_CREATE_g'
//usr/local/lib/libmatio.so: undefined reference to `H5T_NATIVE_USHORT_g'
//usr/local/lib/libmatio.so: undefined reference to `H5Dvlen_reclaim'
//usr/local/lib/libmatio.so: undefined reference to `H5Tclose'
//usr/local/lib/libmatio.so: undefined reference to `H5Fopen'
//usr/local/lib/libmatio.so: undefined reference to `H5Pset_chunk'
//usr/local/lib/libmatio.so: undefined reference to `H5Fclose'
//usr/local/lib/libmatio.so: undefined reference to `H5T_NATIVE_DOUBLE_g'
//usr/local/lib/libmatio.so: undefined reference to `H5T_NATIVE_ULLONG_g'
//usr/local/lib/libmatio.so: undefined reference to `H5Dcreate2'
//usr/local/lib/libmatio.so: undefined reference to `H5T_STD_REF_OBJ_g'

我尝试了许多其他代码来解决它:

g++ refine_pascal_v4/dense_inference.cpp -o prog_refine_pascal_v4 -W -Wall -O2 -L /usr/local/MATLAB/R2014a/bin/glnxa64 -lDenseCRF -lmatio -I./util/ -Wl,-rpath=/usr/local/MATLAB/R2014a/bin/glnxa64


g++ refine_pascal_v4/dense_inference.cpp -o prog_refine_pascal_v4 -I /usr/local/MATLAB/R2014a/extern/include -L /usr/local/MATLAB/R2014a/bin/glnxa64 -leng -lmat -lmex -lut -W -Wall -O2 -L. -lDenseCRF -lmatio -I./util/ -Wl,-rpath, /usr/local/MATLAB/R2014a/bin/glnxa64

不确定我做错了什么。

我尝试卸载并重新安装 matio,但没有任何帮助。

答案是在-lmatio后加一个-lhdf5:

g++ refine_pascal_v4/dense_inference.cpp util/Timer.h libDenseCRF.a
$(CC) refine_pascal_v4/dense_inference.cpp -o prog_refine_pascal_v4 $(CFLAGS) -L. -lDenseCRF -lmatio -lhdf5 -I./util/