问题:
报错内容如下:
Warning! ***HDF5 library version mismatched error***
The HDF5 header files used to compile this application do not match
the version used by the HDF5 library to which this application is linked.
Data corruption or segmentation faults may occur if the application continues.
This can happen when an application was compiled by one version of HDF5 but
linked with a different version of static or shared HDF5 library.
You should recompile the application or check your shared library related
settings such as 'LD_LIBRARY_PATH'.
You can, at your own risk, disable this warning by setting the environment
variable 'HDF5_DISABLE_VERSION_CHECK' to a value of '1'.
Setting it to 2 or higher will suppress the warning messages totally.
Headers are 1.14.0, library is 1.10.2
总结起来就是:VS应用程序由一个版本的HDF5编译,但运行编译好的程序时却与不同版本的静态或共享HDF5库链接,因此报错Headers are 1.14.0, library is 1.10.2,不匹配
分析:
系统刚重装,并没有安装1.10.2版本的hdf5软件,经过检查也并没有。因此,删除1.10.2版本思路行不通。
所以思路是,要运行成功,则需要编译的库与运行时的链接库相同。
解决办法:
1、将运行程序所需的动态链接库,放置到程序所在的目录下。(相关的dll文件)
2、放置到,c:/windows/system32中
其他总结:
使用静态链接库,可能需要具有正确版本HDF5库的库文件(.lib)以及对应的头文件(.h)。
使用动态链接库加载需要确保正确版本的共享库文件(.dll)位于可执行文件的搜索路径上或者已将其路径添加到系统环境变量中。
如果不知道具体需要啥,就把所有bin文件夹下的dll文件复制过去。
基本上,编译时不报错,运行时报错,都可以复制dll文件的方法解决。