Search code examples
c++hdf5

How to run a test for a single function on a hdf5


I am trying to test tarray.cpp. I know you can use cmake, but I need to use G++ for a project. I just need to test the tarray portion and its dependencies. I put the tarray and all its dependencies in the same folder. However, when I try to compile it, I get this error:

$ g++ tarray.cpp -o tarray

In file included from H5Cpp.h:18:0, from tarray.cpp:28:

H5Include.h:15:10: fatal error: hdf5.h: No such file or directory

#include <hdf5.h>
          ^~~~~~~~
compilation terminated.

I have the hdf5 in the same folder, so I do not know why it does not detect it.


Solution

  • Change #include <hdf5.h> to #include "hdf5.h".

    See What is the difference between #include and #include “filename”?.

    The quotes around the #include will check in the current directory, while the angle brackets will check the include path.