Parenting Camera to head in C++ vs Blueprint problem

I am trying to make a FPS out of the default TP project. The CONOPS of placing the FollowCamera a child of the Head and removing the CameraBoom is straightforward. My problem comes in when I try to attach the camera to the head in C++ vs. Blueprints. When using BP you have to place the Camera as a child of the Mesh and attach the head to the parent socket of the Camera. Straightforward in BP. But I don’t want to program in BP.
I cannot seem to get this working in C++. So far I have created a “headSocket” within the “head” bone and have written the following:

 
    /*
    CameraBoom = CreateDefaultSubobject<USpringArmComponent>(TEXT("CameraBoom"));
    CameraBoom->SetupAttachment(RootComponent);
    CameraBoom->TargetArmLength = 300.0f; // The camera follows at this distance behind the character    
    CameraBoom->bUsePawnControlRotation = true; // Rotate the arm based on the controller
    */

    // Create a follow camera
    FollowCamera = CreateDefaultSubobject<UCameraComponent>(TEXT("FollowCamera"));
    FollowCamera->bEditableWhenInherited = true;
    FollowCamera->bUsePawnControlRotation = true; // Camera does not rotate relative to arm
    FollowCamera->SetupAttachment(GetMesh(), FName("headSocket"));

    // I have also tried
    // FollowCamera->AttachTo(GetMesh(), "headSocket");

No type of attachment I can perform seems to work.

I am not on my UE4 PC but i don’t see why is this not working.

So the CameraBoom is useless in your case i suppose? I honestly would keep a short CameraBoom with camera as its child and Attach it to mesh So the user don’t Feel the Dizzy effect of Camera moving with mesh Animations.

have you tried FollowCamera->SetupAttachment(RootComponent)? because you said No attachment seems to work. if that does not work then there might be some other issue.

What is the result of your commented AttachTo? That’s what I do when attaching particle emitters. I imagined it would be the same.