打开HDF5文件错误

Gol*_*Lee 5 c++ hdf5

我创建了一个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
}           
Run Code Online (Sandbox Code Playgroud)

没有发生编译错误,但未能通过以下异常链接:链接...
创建库F:\ Tips \ Debug \ Tips.lib和对象F:\ Tips \ Debug \ Tips.exp
TwinSatObservation.obj:错误LNK2001:未解决外部符号“公共:静态类H5 :: FileCreatPropList const H5 :: FileCreatPropList :: DEFAULT”(?DEFAULT @ FileCreatPropList @ H5 @@ 2V12 @ B)
TwinSatObservation.obj:错误LNK2001:未解决的外部符号“公共:静态类H5: :FileAccPropList const H5 :: FileAccPropList :: DEFAULT“(?DEFAULT @ FileAccPropList @ H5 @@ 2V12 @ B)
F:\ Tips \ Debug \ Tips.exe:致命错误LNK1120:2个未解决的外部组件

我将以下库添加到VS 2008链接器的“其他依赖项”输入框中
。hdf5dll.lib
hdf5_hldll.lib
hdf5_cppdll.lib
hdf5_hl_cppdll.lib

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

her*_*h10 5

对于具有VS2010或VS2015的hdf5-1.8.17,将其定义H5_BUILT_AS_DYNAMIC_LIB为预处理器设置(“ 项目”>“属性”>“ C / C ++”>“预处理器”>“预处理器定义”)可以为我解决完全相同的症状。多亏了原来的帖子


Gol*_*Lee 2

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