x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

PlayerInputComponent - pointer to incomplete class type is not allowed

Help!
I'm just starting a new project and trying to create player movement. I've done this many times without a problem but this time I got this error: pointer to incomplete class type is not allowed.
I even tried to copy code from previous projects, in which this worked perfectly, but it still doesn't work...
Here's the code:

 void ARandomPlayerName::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
 {
     Super::SetupPlayerInputComponent(PlayerInputComponent);
 
     PlayerInputComponent->BindAxis("MoveForward", this, &ARandomPlayerName::MoveForward);
 
 
 }

Can someone help me?

Product Version: UE 4.16
Tags:
more ▼

asked Jun 25 '17 at 06:06 PM in C++ Programming

avatar image

J0K3R_12QQ
94 21 24 28

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Pointer to Incomplete Class means you're missing an include.

Add

 #include "Components/InputComponent.h"
more ▼

answered Jun 25 '17 at 06:20 PM

avatar image

ExtraLifeMatt
1.6k 34 14 48

avatar image J0K3R_12QQ Jun 25 '17 at 06:22 PM

Why? I never needed that.

Well, probably because of 4.16 right?

Also UCameraComponent? Do I need to include Components/CameraComponent?
Is there a new header for all of those components or do I have include a new one for every single component?

avatar image ExtraLifeMatt Jun 25 '17 at 06:24 PM

Yes, as Ninjin points out, 4.15/4.16 moved to an Include What You Use (IWYU) model, so you'll need to manually include headers for objects/components/etc that you use.

avatar image J0K3R_12QQ Jun 25 '17 at 06:25 PM

But "Components/CameraComponent" doesn't exist, what's the header for that?

avatar image ExtraLifeMatt Jun 25 '17 at 06:26 PM

"Camera/CameraComponent.h"

avatar image J0K3R_12QQ Jun 25 '17 at 06:27 PM

Oh, thank you.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question