No announcement yet.

PCIP: Undeclared Identifier

  • Filter
  • Time
  • Show
Clear All
new posts

  • replied
    You can only access that variable from the constructor. If you move that code into the constructor everything will work.

    Leave a comment:

  • started a topic PCIP: Undeclared Identifier

    PCIP: Undeclared Identifier

    I've been following along with the FPS code tutorial and gotten as far as creating a default camera. I'm running into issues with PCIP not being found, however. My notes are inlined below and I've stripped out some superfluous code and comments.

    AFPSCharacter::AFPSCharacter(const class FPostConstructInitializeProperties& PCIP) : Super(PCIP) {
    // I see that PCIP is being passed to the parent class.  I would have thought I'd have access to it in my subclass, but...
    void AFPSCharacter::BeginPlay() {
    // Do other things here
    	FirstPersonCameraComponent = PCIP.CreateDefaultSubobject<UCameraComponent>(this, TEXT("FirstPersonCamera"));
    // More stuff!
    When I do a build I get the following error: "Error 1 error C2065: 'PCIP' : undeclared identifier <path>\FPSCharacter.cpp 18 1 <Project>"

    EDIT: I swear I spent all of yesterday working on this. Found the solution. I don't need to keep track of the PCIP object because I don't need to use it outside of the constructor. I moved the FirstPersonCameraComponent (and some of the other things that relied on PCIP) into the constructor.

    I feel like I could close and delete this thread, but it might be of some use to people who Google for it in the future. If there are no objections I'll leave it up with the answer.
    Last edited by Jo_; 09-08-2014, 11:10 PM. Reason: Found a solution.