1

I've got problems including a script to open and read data from an existing HDF5-File in a larger C++ Project. I could include the libraries and headers so that there is no longer the error message: "undefined reference" when trying to link all the files.

Now I'm able to build my Project (with eclipse) but when I come to the point to open my existing hdf5-file

const H5std_string FILE_NAME_ALL ("RADAR.h5");

 /*
* Open the specified file
*/
H5File *file = new H5File( FILE_NAME_ALL, H5F_ACC_RDONLY );

I get the following error:

HDF5-DIAG: Error detected in HDF5 (1.8.11) thread 0:
  #000: ../../src/H5F.c line 1582 in H5Fopen(): unable to open file
    major: File accessibilty
    minor: Unable to open file
  #001: ../../src/H5F.c line 1271 in H5F_open(): unable to open file: time = Thu Apr 10 16:43:53 2014
, name = 'RADAR.h5', tent_flags = 0
    major: File accessibilty
    minor: Unable to open file
  #002: ../../src/H5FD.c line 987 in H5FD_open(): open failed
    major: Virtual File Layer
    minor: Unable to initialize object
  #003: ../../src/H5FDsec2.c line 343 in H5FD_sec2_open(): unable to open file: name = 'RADAR.h5', errno = 2, error message = 'No such file or directory', flags = 0, o_flags = 0
    major: File accessibilty
    minor: Unable to open file

Do you know what could have been wrong here?

tshepang
  • 12,111
  • 21
  • 91
  • 136
smaica
  • 723
  • 2
  • 11
  • 26
  • 2
    Do you have the rights to open/read the file? The file exists where the program expects it to be? Check the applications current directory (use e.g. [`getcwd`](http://pubs.opengroup.org/onlinepubs/009695399/functions/getcwd.html) to find out the applications current working directory). – Some programmer dude Apr 10 '14 at 14:55
  • Yes, I have the permission. I can open the file when extracting the Script to a "stand alone" eclipse-Project. But when I try to include this in the large program it doesn't work. I have the file in the same directory as my source codes. – smaica Apr 11 '14 at 06:07
  • The actual executable program is most likely *not* in the same folder as the sources. It might even be that when running from inside Eclipse you might have a working directory that is something different from where the executable is located. You really need to check the working directory of the program, and either change the path of the file to that directory, or move the file. – Some programmer dude Apr 11 '14 at 06:40
  • Okay. I got my Problem. I had two: 1. You were right with the working directory. Now I use absolute paths and the opening worked. The second thing was, that I first used external links to link several hdf5 files to a single one. For these external links I didn't use absolute paths as well. So conclusion: ALWAYS work with absolute paths (: - Thanks a lot! – smaica Apr 11 '14 at 07:10
  • Thanks smaica for providing the solution, I had the same problem! – sorry_I_wont Jun 28 '16 at 17:01
  • So you did not change the location of your file, you just used an absolute path and then it worked regardless of the location of the file? –  Nov 16 '17 at 07:58

0 Answers0