No compiler was found

When creating a new c++ project or c++ class it says “No compiler was found. Please install visual studio 2017”.
However, I have it installed and the problem still occurs after installing and uninstalling UE4 and visual studio many times.
It worked before but I had to uninstall VS due to a problem and now this appears.
I think the problem is that the environment variables aren’t well set but I have no idea of how to do that.

Could somebody please help me?