开发者

Open an HDF5 file error

开发者 https://www.devze.com 2023-03-25 08:22 出处:网络
I created an HDF5 file open function like the following: int OpenHDF5(string sFileName) { // Check for valid HDF5 file

I created an HDF5 file open function like the following:

int OpenHDF5(string sFileName)
{   
    // Check for valid HDF5 file 
    if (!H5File::isHdf5(sFileName.c_str())) 
    {   
       // Invalid HDF5 file
       return -1
    }

    // Try block t开发者_Python百科o 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
}           

No compiling error occurred, but failed to link with the following exceptions: Linking...

Creating library F:\Tips\Debug\Tips.lib and object F:\Tips\Debug\Tips.exp

TwinSatObservation.obj : error LNK2001: unresolved external symbol "public: static class H5::FileCreatPropList const H5::FileCreatPropList::DEFAULT" (?DEFAULT@FileCreatPropList@H5@@2V12@B)

TwinSatObservation.obj : error LNK2001: unresolved external symbol "public: static class H5::FileAccPropList const H5::FileAccPropList::DEFAULT" (?DEFAULT@FileAccPropList@H5@@2V12@B)

F:\Tips\Debug\Tips.exe : fatal error LNK1120: 2 unresolved externals

I added the following libraries to "Addtional Dependencies" input box of the VS 2008 Linker

hdf5dll.lib

hdf5_hldll.lib

hdf5_cppdll.lib

hdf5_hl_cppdll.lib

Would you please tell me which library I forgot to add? Thank you very much!


As for hdf5-1.8.17 with either VS2010 or VS2015, defining H5_BUILT_AS_DYNAMIC_LIB as a preprocessor setting (Project > Properties > C/C++ > Preprocessor > Preprocessor Definitions) cures exactly the same symptom for me. Thanks to the original post.


Add HDF5CPP_USEDLL;_HDF5USEDLL_; in Preprocessor Definitions input box.

0

精彩评论

暂无评论...
验证码 换一张
取 消