If the c++ code gets the error that '__xpg_basename' is not a member of 'namespace or class' check for use of libgen.h
The file libgen.h has a #define basename __xpg_basename that will replace all occurrences of basename including those of other classes.
It may be possible to reorder includes to avoid the error. Make libgen.h be included last.