It seems that you might have a mixed-up build. To solve the problem, you might need to:
- Make sure there is no ROOT installation on the PATH or LD_LIBRARY_PATH
- Make sure that the compiler in the PATH is the one you intend to use
- start from a fresh/empty build directory
- Make sure to request the C++ standard you need (this can not be changed later for a given build directory).