I'm having this problem with the Visual Studio Code's compiler. It keeps on compiling the obj. and bin. files which it's not supposed to because then it's throwing error messages and doesn't work for other scripts.
I've tried to solve it by deleting the obj. and bin. folders on my desktop as unity regenerate them upon opening the project again. I also tried to regenerate the project files in unity but nothing seems to work as Omni Sharp keeps on giving me the same error. I also tried to create a new project to see if the Visual Studio Code will give me the same error (hoping it would not) but this seems to be the problem with every unity project now.