打开HDF5文件错误

Open an HDF5 file error

本文关键字:错误 文件 HDF5 打开      更新时间:2023-10-16

创建了一个HDF5文件打开函数,如下所示:

int OpenHDF5(string sFileName)
{   
    // Check for valid HDF5 file 
    if (!H5File::isHdf5(sFileName.c_str())) 
    {   
       // Invalid HDF5 file
       return -1
    }
    // Try block to detect exceptions raised by any of the calls inside it
    try
    {  
       // Turn off the auto-printing when failure occurs so that we can handle the errors appropriately
       Exception::dontPrint();
       // Now Open the file
       H5File file( sFileName.c_str(), H5F_ACC_RDONLY ); 
    }  
    // Catch failure caused by the H5File operations
    catch( FileIException error )
    {   
        error.printError();
        return -1
    }
    return 0
}           

未发生编译错误,但未能链接以下异常:链接…
创建库F:TipsDebugTips。lib和对象F:TipsDebugTips.exp
TwinSatObservation。obj:错误LNK2001:未解析的外部符号"public: static class H5::FileCreatPropList const H5::FileCreatPropList::DEFAULT" (?DEFAULT@FileCreatPropList@H5@@2V12@B)
TwinSatObservation。obj:错误LNK2001:未解析的外部符号"public: static class H5::FileAccPropList const H5::FileAccPropList::DEFAULT" (?DEFAULT@FileAccPropList@H5@@2V12@B)
F:TipsDebugTips.exe:致命错误LNK1120: 2个未解析的外部

我在VS 2008链接器的"附加依赖项"输入框中添加了以下库
hdf5dll。自由
hdf5_hldll。自由
hdf5_cppdll。自由
hdf5_hl_cppdll.lib

你能告诉我我忘记添加了哪个库吗?非常感谢!

对于VS2010或VS2015的hdf5-1.8.17,将H5_BUILT_AS_DYNAMIC_LIB定义为预处理器设置(Project> Properties> C/c++> preprocessor> preprocessor Definitions)对我来说完全相同的症状。感谢原帖

预处理器定义输入框中添加HDF5CPP_USEDLL;_HDF5USEDLL_;