v3.5.1 seems to have an issue when building with gcc-13 in the file session.c[1]. A single #include <string> in https://github.com/YafaRay/libYafaRay/blob/v3.5.1/include/core_api/session.h#L28 solved the issue for me. Due to being a trivial patch, I didn't bother to open a PR. If you want me to submit a PR, please ping back to me.
[1] https://bugs.gentoo.org/895208