码迷,mamicode.com
首页 > 其他好文 > 详细

如何正确的将HDF5加入到项目中进行编译(雾)?!

时间:2017-02-18 18:38:10      阅读:259      评论:0      收藏:0      [点我收藏+]

标签:cmake   color   data   rar   htm   bin   ica   span   sha   

1 什么是HDF5

官方解释:

HDF5 is a unique technology suite that makes possible the management of extremely large and complex data collections.

看起来HDF5就是一种用来存储各种数据的一个容器/管理者。

2 为什么要弄这个组件到项目中去?

鉴于很多模型都使用这个格式进行数据存储,所以在测试项目是难免会用到HDF5这个部分。所以这里对其加入到项目中做了以下总结。

3 将HDF5加入到项目需要那几步?可能会遇到什么问题了?

大体上可以总结为三个部分:

(1)下载合适的部分

  这个当然难不到聪明的你了,放一个链接:https://support.hdfgroup.org/HDF5/release/obtain518.html  

选择 Windows 64-bit (No SZIP)   [1]   Compilers:   CMake VS 2013 C, C++, IVF 15

  or (https://support.hdfgroup.org/HDF5/release/obtain5.html)

  注意:这里选择了x64版本

(2)添加到项目中

Add the header path to the "Include Directories" setting.

  eg:C:\Program Files\HDF_Group\HDF5\1.8.18\include

Add the library path to the "Library Directories" setting.

  eg:C:\Program Files\HDF_Group\HDF5\1.8.18\lib

  添加头文件和库文件到C++目录中去,

  添加HDF5的bin文件到环境path中: eg:C:\Program Files\HDF_Group\HDF5\1.8.18\bin

Select Linker->Input and beginning with the
"Additional Dependencies" line, enter the library names. The
external libraries should be listed first, followed by the HDF5
library, and then optionally the HDF5 High Level, Fortran or C++
libraries. For example, to compile a C++ application, enter:

  szip.lib zlib.lib hdf5.lib hdf5_cpp.lib

  添加合适的lib进行编译

  由于我选择了 NoSZIP的版本,结果就是  

zlib.lib hdf5.lib hdf5_cpp.lib

(3)编译

  进行了上述的操作了就完成了99%,为什么?

  接下来就会遇到 error LNK2001: 无法解析的外部符号 _H5T_NATIVE_DOUBLE_g

  这样的问题,所以bing搜索找到了解决方案():

  《1》http://www.cnblogs.com/yeahgis/p/3141441.html

  《2》http://www.xuebuyuan.com/1267127.html

  but these solutions don‘t work. why?

  很是疑惑的我想着官方网站能不能给我一些提示:https://support.hdfgroup.org/HDF5/release/obtain518.html  

  下面有一个行字比较醒目:To use the shared libraries on Windows with Visual Studio you must specify the H5_BUILT_AS_DYNAMIC_LIB compile definition.

  是的将H5_BUILT_AS_DYNAMIC_LIB加入到编译器预编译选项,就解决了上面了问题。

  

文章参考:

1. http://www.cnblogs.com/nwpuxuezha/p/4655014.html

2. http://www.cnblogs.com/yeahgis/p/3141441.html

3. http://www.xuebuyuan.com/1267127.html

4. https://support.hdfgroup.org/HDF5/release/obtain518.html

5. https://support.hdfgroup.org/HDF5/release/obtain5.html

如何正确的将HDF5加入到项目中进行编译(雾)?!

标签:cmake   color   data   rar   htm   bin   ica   span   sha   

原文地址:http://www.cnblogs.com/kalluwa/p/6413686.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!