Download

Pointer to incomplete Class type not allowed (UMotionControllerComponent)

So, i am trying to create a VR-project using pure C++. What i have done is this:

I edited the Build.cs file and added these:
PrivateDependencyModuleNames.AddRange(new string] { “HeadMountedDisplay”, “SteamVR”, “SteamVRController” });

In game i created a new C++ class from Actor. in .H file i have:



#include "GameFramework/Actor.h"

// VR. Remember to set depency in projectName.Build.cs
#include "Runtime/HeadMountedDisplay/Public/IHeadMountedDisplay.h"
#include "Runtime/HeadMountedDisplay/Public/MotionControllerComponent.h"

#include "MyMotionControllerLHand.generated.h"

private:
	// Creating Scene
	UPROPERTY(VisibleDefaultsOnly, BlueprintReadOnly, meta = (AllowPrivateAccess = "true"))
	class USceneComponent* Root; // Scene

	// Creating Static Mesh
	UPROPERTY(VisibleDefaultsOnly, BlueprintReadOnly, meta = (AllowPrivateAccess = "true"))
	class UStaticMeshComponent* HandMesh;

	// Create motion controller
	UPROPERTY(EditDefaultsOnly)
	class UMotionControllerComponent* MotionControllerr;



In .CPP file i have


	
// Set this actor to call Tick() every frame.  You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;

// Create Root
Root = CreateDefaultSubobject<USceneComponent>(TEXT("Root"));
RootComponent = Root;

MotionControllerr = CreateDefaultSubobject<UMotionControllerComponent>(TEXT("MotionController"));
MotionControllerr->AttachTo(Root)

And this is where the problem starts. The MotionControllerr is always red and if i hover my mouse over it says Pointer to incomplete Class type not allowed. I cannot get anything out from the controller. It’s just a empty shell. CreateDefaultSubobject works, but after that, i cannot use it anywhere

What am i missing here? Anybody can help? Thanks.

Also, if i try to attach something to it, it says error again:
anotherError.png

I got the game to compile correctly, but can i get the error messages away?

Did you generate Visual Studio project files from your .uproject file after those modifications to your Build.cs file?

If everything is setup correctly you should also be able to simply #include “MotionControllerComponent.h” rather than specifying the “full” relative path from the engine’s source folder. Similarly it should be possible to directly #include “IHeadMountedDisplay.h”.