Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Open an HDF5 file error

Tags:

c++

hdf5

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 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
}           

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!

like image 823
GoldenLee Avatar asked Aug 04 '11 03:08

GoldenLee


People also ask

How do I open an HDF5 file?

Open a HDF5/H5 file in HDFViewOpen this file in HDFView. If you click on the name of the HDF5 file in the left hand window of HDFView, you can view metadata for the file. This will be located in the bottom window of the application.

What is an HDF5 file?

The Hierarchical Data Format version 5 (HDF5), is an open source file format that supports large, complex, heterogeneous data. HDF5 uses a "file directory" like structure that allows you to organize data within the file in many different structured ways, as you might do with files on your computer.

What is HDF5 viewer?

HDFView is a visual tool, written in Java, suitable for browsing and editing HDF (Hierarchical Data Format) (HDF5 and HDF4) files, such as the SMOS L2 data. Using HDFView, you can: View a file hierarchy in a tree structure. Create new files, add or delete groups and datasets. View and modify the content of a dataset.


2 Answers

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.

like image 160
herrlich10 Avatar answered Sep 17 '22 02:09

herrlich10


Add HDF5CPP_USEDLL;_HDF5USEDLL_; in Preprocessor Definitions input box.

like image 43
GoldenLee Avatar answered Sep 19 '22 02:09

GoldenLee