HDF5链接错误

时间:2018-04-26 12:18:38

标签: c++ c++11 hdf5

关联我的hdf5代码时出现以下错误。我做错了什么想法。

我正在使用的命令:

  

g ++ -std = c ++ 11 -m64 -DOPENFOAM_PLUS = 1712 -Dlinux64 -DWM_ARCH_OPTION = 64 -DWM_DP -DWM_LABEL_SIZE = 32 -Wall -Wextra -Wold-style-cast -Wnon-virtual-dtor -Wno-unused-参数-Wno-invalid-offsetof -Wno-attributes -O3 -DNoRepository -ftemplate-depth-100 -I / opt / software / OpenFOAM / OpenFOAM-v1712 / src / finiteVolume / lnInclude -I / opt / software / OpenFOAM / OpenFOAM- v1712 / src / sampling / lnInclude -I / opt / software / OpenFOAM / OpenFOAM-v1712 / src / meshTools / lnInclude -IlnInclude -I。 -I / opt / software / OpenFOAM / OpenFOAM-v1712 / src / OpenFOAM / lnInclude -I / opt / software / OpenFOAM / OpenFOAM-v1712 / src / OSspecific / POSIX / lnInclude -fPIC -Xlinker --add-needed -Xlinker - -no-as-needed Make / linux64GccDPInt32Opt / 3DIBicoFoam_2.o -L / opt / software / OpenFOAM / OpenFOAM-v1712 / platforms / linux64GccDPInt32Opt / lib \       -lfiniteVolume -lsampling -L / local / hulfeldl / hdf5 / lib / libhdf5_hl_cpp.a -L / local / hulfeldl / hdf5 / lib / libhdf5_cpp.a -L / local / hulfeldl / hdf5 / lib / libhdf5_hl.a -L / local /hulfeldl/hdf5/lib/libhdf5.a -lhdf5_hl_cpp -lhdf5_cpp -lhdf5_hl -lhdf5 -lsz -lz -ldl -lm -lOpenFOAM -ldl        -lm -o / local / hulfeldl / OpenFOAM / hulfeldl-v1712 / applications / bin / linux64GccDPInt32Opt / 3DIBicoFoam_2

错误:

Make/linux64GccDPInt32Opt/3DIBicoFoam_2.o: In function `main':
3DIBicoFoam_2.C:(.text.startup+0x107b): undefined reference to 
`H5::H5Location::openDataSet(std::string const&) const' 
3DIBicoFoam_2.C:(.text.startup+0x17de): undefined reference to 
`H5::H5Location::openDataSet(std::string const&) const'
3DIBicoFoam_2.C:(.text.startup+0x189e): undefined reference to 
`H5::H5Location::openDataSet(std::string const&) const'
3DIBicoFoam_2.C:(.text.startup+0x1919): undefined reference to 
`H5::H5Location::openDataSet(std::string const&) const'
3DIBicoFoam_2.C:(.text.startup+0x19d0): undefined reference to 
`H5::H5Location::openDataSet(std::string const&) const'

1 个答案:

答案 0 :(得分:0)

请先删除所有-L/...a。在命令中添加一个-L/local/hulfeldl/hdf5/lib保留所有-lhdf...。然后重试。

对于运行时,请在运行程序之前运行以下命令。

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/local/hulfeldl/hdf5/lib