[c++]Why can't I use SetSkeletalMesh()?

Do you have included the Header for skeletalmesh? With the new Include what you Need System you have to include each Header on you own.
You Need Components/SkeletalMeshComponent.h

Have a look here:

And here:
https://docs.unrealengine.com/latest/INT/Programming/UnrealBuildSystem/IWYUReferenceGuide/index.html