"stray" errors often occur when you copy paste code from somewhere and you get weird characters copied into your code. Often they are invisible so it's hard to spot.
Copy the code from your post and you will probably be able to compile, at least it worked for me.