Attach weapon using C++

You are already creating an instance of the weapon class with:

AMyWeapon* wep = GetWorld()->SpawnActor<AMyWeapon>(AMyWeapon::StaticClass(), spawnParams);

My last two comments refer to how you create a SkeletalMeshComponent on your weapon class to display the mesh.

The skeletal mesh can be set as follows (please note that I do it outside of the constructor):

// Find the Mesh
USkeletalMesh* WeaponSkelMesh = Cast<USkeletalMesh>(StaticLoadObject(USkeletalMesh::StaticClass(), NULL, TEXT("pathToYourMeshInContentBrowser")));

// Set mesh
Weapon->SetSkeletalMesh(WeaponSkelMesh);