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"

C++ Interface Implementation compile issue

EDIT: I FIXED THE ISSUE, THE CODE IMPLEMENTATION BELOW WORKS FINE.

Hi there, I can't manage to compile c++ class with interface implemented in it.

PlayerController_Interface.h

 // Fill out your copyright notice in the Description page of Project Settings.
 
 #pragma once
 #include "PlayerController_Interface.generated.h"
 
 
 /**
 *
 */
 UINTERFACE(Blueprintable, MinimalAPI)
 
 class UPlayerController_Interface : public UInterface
 {
     GENERATED_UINTERFACE_BODY()
 };
 
 class IPlayerController_Interface
 {
     GENERATED_IINTERFACE_BODY()
 
 public:
 
     UFUNCTION(BlueprintNativeEvent, BlueprintCallable, Category = "Fancy")
         FString FancyFunction() const;
 };

PlayerController_Interface.cpp

 // Fill out your copyright notice in the Description page of Project Settings.
 
 #include "ProjectSpace.h"
 #include "PlayerController_Interface.h"
 
 
 UPlayerController_Interface::UPlayerController_Interface(const FObjectInitializer& ObjectInitializer)
     : Super(ObjectInitializer)
 {
 }

And here i implement interface to player controller

PlayerControllerBase.h

 // Fill out your copyright notice in the Description page of Project Settings.
 
 #pragma once
 
 #include "GameFramework/PlayerController.h"
 #include "PlayerController_Interface.h"
 #include "PlayerControllerBase.generated.h"
 
 /**
  * 
  */
 UCLASS()
 
 class PROJECTSPACE_API APlayerControllerBase : public APlayerController , public IPlayerController_Interface
 {
     GENERATED_BODY()
 
 public:
 
     virtual FString FancyFunction_Implementation() const override;
 
 };

PlayerControllerBase.cpp

 // Fill out your copyright notice in the Description page of Project Settings.
 
 #include "ProjectSpace.h"
 #include "PlayerControllerBase.h"
 
 FString APlayerControllerBase::FancyFunction_Implementation() const
 {
     return "Hello";
 }



Product Version: UE 4.12
Tags:
more ▼

asked Aug 22 '16 at 09:49 AM in C++ Programming

avatar image

CriErr
1.2k 57 21 56

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

1 answer: sort voted first

It was syntax error.

more ▼

answered Aug 22 '16 at 02:54 PM

avatar image

CriErr
1.2k 57 21 56

(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