I'm currently using hdf5 1.8.15 on Windows 7 64bit. The sourcecode of my software is saved in files using utf8 encoding.
As soon as I call any hdf5 function supporting std:: string, the ouput gets cryptic
But if I use const char*
instead of std::string
, everything works fine. This applies also to the filename.
Here is a short sample:
std::string filename_ = "test.h5";
H5::H5File file( filename_.c_str(), H5F_ACC_TRUNC); // works
H5::H5File file( filename_, H5F_ACC_TRUNC); // filename is not readable or
// hdf5 throws an exception
I guess that this problem is caused by different encodings used in my source files and hdf5. But I'm not sure about this and found no solution allowing the use of std::string
s. I would appreciate any idea which helps me with this issue.
I also had the same problem, and fixed it by changing all my std::string or h5std_string to literally:
Or use
string.c_str()
to change the string toconst char
.I had exactly the same problem. The solution was, that I was in Debug-Mode in Visual Studio, whereas the libraries I linked against were build in Release-Mode. When I switched in Visual Studio to Release-Mode, the above error disappeared.