Unable to create a file in H5CPP

I am trying to run an example code given [here] (https://raw.githubusercontent.com/HDFGroup/hdf5/develop/c++/examples/h5tutr_crtdat.cpp) using VS code 2022.

  1. I have installed hdf5-1.14.3-Std-win10_64-vs17.
  2. Have added the include and lib path to VS code additional include and library path.
  3. Then added hdf5.lib and hdf5_Cpp.lib to additional dependencies.
  4. Under C/C++ → preprocessor definitions have added H5_BUILT_AS_DYNAMIC_LIB

The program builds successfully. When I run the code it shows error

HDF5-DIAG: Error detected in HDF5 (1.14.3) thread 0:
#000: C:\autotest\hdf5114-StdRelease-dist-10vs17\build\hdfsrc\src\H5F.c line 660 in H5Fcreate(): unable to synchronously create file
major: File accessibility
minor: Unable to create file
#001: C:\autotest\hdf5114-StdRelease-dist-10vs17\build\hdfsrc\src\H5F.c line 614 in H5F__create_api_common(): unable to create file
major: File accessibility
minor: Unable to open file
#002: C:\autotest\hdf5114-StdRelease-dist-10vs17\build\hdfsrc\src\H5VLcallback.c line 3605 in H5VL_file_create(): file create failed
major: Virtual Object Layer
minor: Unable to create file
#003: C:\autotest\hdf5114-StdRelease-dist-10vs17\build\hdfsrc\src\H5VLcallback.c line 3571 in H5VL__file_create(): file create failed
major: Virtual Object Layer
minor: Unable to create file
#004: C:\autotest\hdf5114-StdRelease-dist-10vs17\build\hdfsrc\src\H5VLnative_file.c line 94 in H5VL__native_file_create(): unable to create file
major: File accessibility
minor: Unable to open file
#005: C:\autotest\hdf5114-StdRelease-dist-10vs17\build\hdfsrc\src\H5Fint.c line 1852 in H5F_open(): unable to open file: name = ‘░òyÑí☻’, tent_flags = 13
major: File accessibility
minor: Unable to open file
#006: C:\autotest\hdf5114-StdRelease-dist-10vs17\build\hdfsrc\src\H5FD.c line 769 in H5FD_open(): open failed
major: Virtual File Layer
minor: Unable to initialize object
#007: C:\autotest\hdf5114-StdRelease-dist-10vs17\build\hdfsrc\src\H5FDsec2.c line 326 in H5FD__sec2_open(): unable to open file: name = ‘░òyÑí☻’, errno = 22, error message = ‘Invalid argument’, flags = 13, o_flags = 302
major: File accessibility
minor: Unable to open file

Not sure if I am doing the setup wrong. I am quite new to H5CPP and VS. Any help is greatly appreciated. Thank you

Are you opening a file with a Unicode file name?

And, more specifically re: Unicode - is this a Japanese file on a system that uses code pages instead of Unicode?

No. The file name is just an english word. I am running the example file as such without any changes.
I tried providing absolute path name as given in this post and it stopped throwing error and created a file with some unreadable file name and format.

Then, I changed from debug to release configuration in VS 2022 and it resolved the issue.
Thank you. But I am just curious to know what difference it makes to run in debug or release configuration. If this is out of scope of this forum, it is okay to close this topic here.

My first thought would be that it has something to do with our library linked to a release flavor of the CRT and your application being linked to a debug CRT. I’m pretty sure those are two separate dlls that don’t share state.