3

I am trying to compile a C++ program using g++ which uses the H5Cpp.h header file. g++ is producing a fatal error saying:

fatal error: H5Cpp.h: No such file or directory

I have already installed the library libhdf5-serial-dev and whatever else comes with it. I am using ubuntu 15.10.

Checked that H5Cpp.h is actually present in /usr/include/hdf5/serial/ as per the file list of package libhdf5-dev.

7
  • Where exactly are you (or the compiler) looking? it seems to be in /usr/include/serial (whereas older releases might have placed it directly in /usr/include): see File list of package libhdf5-dev in wily of architecture amd64 Nov 25, 2015 at 0:17
  • @steeldriver how do I check where is the compiler looking for the header? I checked in the directory (/usr/include/hdf5/serial/) from the file list that the header files are there in the proper directory. Nov 25, 2015 at 9:04
  • You could either add /usr/include/serial to the include path (e.g. -I /usr/include/serial) or change the include directive in your source file from #include <H5Cpp.h> to #include <serial/H5Cpp.h>: if you want more explicit help you will need to provide details about your program and build process (compiler commands, Makefiles etc.) Nov 25, 2015 at 12:50
  • Using -I /usr/include/hdf5/serial/ helps (not -I /usr/include/serial/). But now it gives some other errors, which I guess are not related to the question I have asked.. So I'm not sure whether to elaborate on it here or not. Also, its not any kind of complicated program, its actually an example from HDF5 Group. I am only doing g++ myfile.cpp -o myfile_e -I /usr/..., no other options or anything. If you add that comment with change of the path as answer I will mark it. Nov 25, 2015 at 15:28
  • Have you tried using the h5c++ helper script instead of running g++ directly? Nov 25, 2015 at 16:24

1 Answer 1

1

As I mentioned in the edit of the question, the files are there, but g++ can't find them. The HDFGroup tells us to use h5c++ to compile programs which use hdf5 header files. As steeldriver mentions in the comments on the question, it is a helper script; I tested it, and it has solved the problem I was facing.

1
  • 1
    Is there a way how to manually link hdf5, should I be not so fond of h5c++? Nov 13, 2018 at 13:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .