Hi Edgar,
I did find a solution to this and it required a couple of tweaks.
With some googling i found that the version of Unreal that the series is using makes use of the âMonolithicâ headers, which I believe means when you use simple includes like âEngine.hâ you are essentially asking the compiler to parse EVERYTHING in the engine headers.
The newer version I am using (4.16.3) is using the IWYU Headers now (i believe it means âInclude What You Useâ) which increases compile time speed as the compiler has markedly less files to parse through to compile the code.
From the research on it I did I found that using:
#include "Components/SkeletalMeshComponent.h"
fixes the incomplete type error as the compiler now sees the parent class it needs for a skeletal mesh component.
as for the attachment issue I found by trial and error that I could get it to work though I cannot remember the exact steps.
below is the first 68 lines of my FirstPersonCharacter.cpp that you could use to compare to yours to see if your includes are the same and if your code is similar although i would recommend not copy pasting into your project as it may cause more undesired errors:
#include "FirstPersonCharacter.h"
#include "GameFramework/Actor.h"
#include "GameFramework/Character.h"
#include "Camera/CameraComponent.h"
#include "Components/CapsuleComponent.h"
#include "Components/InputComponent.h"
#include "Components/SkeletalMeshComponent.h"
#include "GameFramework/InputSettings.h"
#include "Weapon/Gun.h"
#include "Kismet/HeadMountedDisplayFunctionLibrary.h"
#include "Kismet/GameplayStatics.h"
#include "MotionControllerComponent.h"
DEFINE_LOG_CATEGORY_STATIC(LogFPChar, Warning, All);
//////////////////////////////////////////////////////////////////////////
// AFirstPersonCharacter
AFirstPersonCharacter::AFirstPersonCharacter()
{
// Set size for collision capsule
GetCapsuleComponent()->InitCapsuleSize(55.f, 96.0f);
// set our turn rates for input
BaseTurnRate = 45.f;
BaseLookUpRate = 45.f;
// Create a CameraComponent
FirstPersonCameraComponent = CreateDefaultSubobject<UCameraComponent>(TEXT("FirstPersonCamera"));
FirstPersonCameraComponent->SetupAttachment(GetCapsuleComponent());
FirstPersonCameraComponent->RelativeLocation = FVector(-39.56f, 1.75f, 64.f); // Position the camera
FirstPersonCameraComponent->bUsePawnControlRotation = true;
// Create a mesh component that will be used when being viewed from a '1st person' view (when controlling this pawn)
Mesh1P = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("CharacterMesh1P"));
Mesh1P->SetOnlyOwnerSee(true);
Mesh1P->SetupAttachment(FirstPersonCameraComponent);
Mesh1P->bCastDynamicShadow = false;
Mesh1P->CastShadow = false;
Mesh1P->RelativeRotation = FRotator(1.9f, -19.19f, 5.2f);
Mesh1P->RelativeLocation = FVector(-0.5f, -4.4f, -155.7f);
// Default offset from the character location for projectiles to spawn
GunOffset = FVector(100.0f, 0.0f, 10.0f);
// Note: The ProjectileClass and the skeletal mesh/anim blueprints for Mesh1P, FP_Gun, and VR_Gun
// are set in the derived blueprint asset named MyCharacter to avoid direct content references in C++.
}
void AFirstPersonCharacter::BeginPlay()
{
// Call the base class
Super::BeginPlay();
if (GunBlueprint == NULL) {
UE_LOG(LogTemp, Warning, TEXT("GunBlueprint is NULL"))
return;
}
Gun = GetWorld()->SpawnActor<AGun>(GunBlueprint);
Gun->AttachToComponent(Mesh1P, FAttachmentTransformRules(EAttachmentRule::SnapToTarget, true), TEXT("GripPoint"));
Gun->AnimInstance = Mesh1P->GetAnimInstance();
//InputComponent->BindTouch(EInputEvent::IE_Pressed, this, &AFirstPersonCharacter::TouchStarted);
InputComponent->BindAction("Fire", IE_Pressed, Gun, &AGun::OnFire);
}
let me know if this helps you solve the issue.
again this code most likely has a lot of bad practices in it and is messy but its what i ahve at the moment and it is working for me. Im almost positive that a couple of the includes are redundant but again, it works