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"

Adding Actor-derived class to a plugin causes a lot of errors

I'm writing a plugin based off the Blueprint Library plugin template. Compiling based off the template with no additional classes works as intended.

I've added a class to it based off of Actor using the New C++ Class wizard from the Content Browser. The one compiler error caused by this mentions that I need to include MyPluginPrivatePCH in the MyActor CPP file.

Doing this produces a deluge of compiler errors [Link] in ComponentInstanceDataCache.h, EngineBaseTypes.h, Map.h, and UObject.h, the nature of which has me a bit perplexed. I'm organizing something here incorrectly, but I haven't got the foggiest idea what.

Current files are as follows:

In Private:

  • MyActor.cpp

  • MyActor.h

  • MyPlugin.cpp

  • MyPluginBPLibrary.cpp

  • MyPluginPrivatePCH.h

In Public:

  • MyActor.h

  • MyPluginBPLibrary.h

In Source:

  • MyPlugin.uplugin

The Actor has no changes to it except that I've added an #include to MyPluginPrivatePCH in the CPP, per the instructions in the Visual Studio output.

MyActor.h:

 #pragma once
 
 #include "GameFramework/Actor.h"
 #include "MyActor.generated.h"
 
 UCLASS()
 class AMyActor : public AActor
 {
     GENERATED_BODY()
     
 public:    
     // Sets default values for this actor's properties
     MyActor();
 
     // Called when the game starts or when spawned
     virtual void BeginPlay() override;
     
     // Called every frame
     virtual void Tick( float DeltaSeconds ) override;
 
     
     
 };

MyActor.cpp

 #include "MyPluginPrivatePCH.h"
 #include "MyPlugin.h"
 #include "MyActor.h"
 
 // Sets default values
 AMyActor::AMyActor()
 {
      // 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;
 
 }
 
 // Called when the game starts or when spawned
 void AMyActor::BeginPlay()
 {
     Super::BeginPlay();
     
 }
 
 // Called every frame
 void AMyActor::Tick( float DeltaTime )
 {
     Super::Tick( DeltaTime );
 
 }

Finally: In Build.cs, I am including Core, CoreUObject, Engine, InputCore, and UnrealEd as private dependency module names.

Product Version: UE 4.13
Tags:
erroroutput.txt (41.9 kB)
more ▼

asked Sep 11 '16 at 06:45 AM in C++ Programming

avatar image

MikePrinke
18 6 8 9

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

1 answer: sort voted first

Found my answer.

You must edit MyPluginPrivatePCH.h to #include "Engine.h". Otherwise it builds all of these in an incorrect order, causing the errors listed in the attached file. Then the plugin builds properly, engine classes and all.

more ▼

answered Sep 12 '16 at 04:44 AM

avatar image

MikePrinke
18 6 8 9

(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