Unreal editor could not compile C++ code

I had first installed visual studio 2017 community and in that setup I had gone to mobile and gaming where i selected C++ with unreal editor. On the right hand side I had ticked on Windows 10 SDK,Windows 8.1 SDK and unreal engine installer ,then it installed visual studio.After that I had installed unreal 4.18. when I tried to create C++ project it stated that could not compile C++ source code and said me to open in visual studio where it had numerous errors.