Just when I thought you were doing so well. Over in this other answer thread
How To Get A Count Of Files[
^]You are using the almost identical program. Our discussion over there indicates that you were successfully compiling, running, and getting outputs. That code also uses wstring.
Now you're over here, asking why wstring is undefined in the code. Better yet, ask yourself what you changed since the earlier program where it did work. Clearly, it didn't break all by itself, you changed something in your code and/or build. You'd figure that out a lot quicker by yourself than posting messages over here and waiting hours for somebody to respond.
So, question 1 is not why it doesn't work but why did it used to work and is now broken.