FPS Tutorial C++

Hi,
I’m following the unreal tutorial to make a fps game in c++.
At this point https://docs.unrealengine.com/latest/INT/Programming/Tutorials/FirstPersonShooter/2/7/index.html i got problem after compiling.
If it can be useful this is the .h and .cpp codes: FPS Tutorial codes - Pastebin.com
I’m using the Unreal Engine 4.16 and Visual Studio 2017

Thanks and sorry for my bad english

This is my guess:

In your Character .h file,

Change:



#include "CoreMinimal.h"
#include "GameFramework/Character.h"
#include "FPSCharacter.generated.h"


to:



#include "CoreMinimal.h"
#include "GameFramework/Character.h"
#include "Camera/CameraComponent.h"
#include "FPSCharacter.generated.h"


If this doesn’t, post the problem you have compiling.

Hello,

Sorry for digging up this thread but I’ve the same problem and I already put on my Character .h file the "#include “Camera/CameraComponent.h” and I got this errors:

Thanks!

YHey maybe the tutorial on my signature can be usefule here

That error has nothing to do with the CameraComponent.h include. As the error says, you cannot convert a “UCapsuleComponent” to a “USceneComponent” in the SetupAttachment function.

Are you following the same FPS tutorial?

If so, you might want to try:



FPSCameraComponent = CreateDefaultSubobject<UCameraComponent>(TEXT("FirstPersonCamera"));
FPSCameraComponent->SetupAttachment();