As already mentioned, you cannot somehow “build” some string at run time and use it as variable name. This is a compile time mechanism, and even if this was a compile time problem, it would be a bad idea.
You most likely want
std::vector<int> nx(someLength);
std::vector<int> ny(someLenght);
int value = 5;
cerr << nx[value] << ny[value] << endl;
instead. (Or the same thing with std::array<int, someLength> nx{}
if someLength
is known at compile time and not big.)
solved C++ how to print union name integer [closed]