The code has the error: "expected unqualified-id before ‘return’", but I do not see any missing bracket or relevant. How is this going to be fixed?

No, there is not a problem in the NN now, the problem is in the creation of the points that will be stored in the tree. I made that question in a second phase. :)