Paper2D: Can't compile PaperSpriteActor

Hey guys!

I created a PaperSpriteActor through the “Add Code To Project” menu and called it “PaperSpriteActorTest”. Everything’s fine, but when i go back to Visual Studio and want to compile, i get this error message (I apologize for any translation errors):


1>  Parsing headers for FlappyShroomyEditor
1>LogTextLocalizationManager : warning : The selected culture 'de_DE' is not available; falling back to 'en'
1>  Reflection code generation finished for FlappyShroomyEditor and took 2,249
1>  Performing 3 actions (max 4 parallel jobs)
1>  FlappyShroomy.generated.cpp
1>  PaperSpriteActorTest.cpp
1>  [3/3] link.exe UE4Editor-FlappyShroomy.dll
1>     Library "C:\Users\\Documents\Unreal Projects\FlappyShroomy\Intermediate\Build\Win64\FlappyShroomyEditor\Development\UE4Editor-FlappyShroomy.lib" and object "C:\Users\\Documents\Unreal Projects\FlappyShroomy\Intermediate\Build\Win64\FlappyShroomyEditor\Development\UE4Editor-FlappyShroomy.exp" are created.
1>PaperSpriteActorTest.cpp.obj : error LNK2001: Unresolved external symbol ""public: virtual bool __cdecl APaperSpriteActor::GetReferencedContentObjects(class TArray<class UObject *,class FDefaultAllocator> &)const " (?GetReferencedContentObjects@APaperSpriteActor@@UEBA_NAEAV?$TArray@PEAVUObject@@VFDefaultAllocator@@@@@Z)".
1>FlappyShroomy.generated.cpp.obj : error LNK2019: Unresolved external symbol ""public: virtual bool __cdecl APaperSpriteActor::GetReferencedContentObjects(class TArray<class UObject *,class FDefaultAllocator> &)const " (?GetReferencedContentObjects@APaperSpriteActor@@UEBA_NAEAV?$TArray@PEAVUObject@@VFDefaultAllocator@@@@@Z)" in Funktion ""class UClass * __cdecl Z_Construct_UClass_AFlappyShroomyGameMode(void)" (?Z_Construct_UClass_AFlappyShroomyGameMode@@YAPEAVUClass@@XZ)".
1>C:\Users\\Documents\Unreal Projects\FlappyShroomy\Binaries\Win64\UE4Editor-FlappyShroomy.dll : fatal error LNK1120: 1 unresolved externals
1>  -------- End Detailed Actions Stats -----------------------------------------------------------
1>ERROR : UBT error : Failed to produce item: C:\Users\\Documents\Unreal Projects\FlappyShroomy\Binaries\Win64\UE4Editor-FlappyShroomy.dll
1>  Cumulative action seconds (8 processors): 0,00 building projects, 0,49 compiling, 0,00 creating app bundles, 0,00 generating debug info, 0,11 linking, 0,00 other
1>  UBT execution time: 7,19 seconds
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.MakeFile.Targets(38,5): error MSB3073: The command ""C:\Unreal Engine 4\Unreal Engine\4.4\Engine\Build\BatchFiles\Build.bat" FlappyShroomyEditor Win64 Development "C:\Users\\Documents\Unreal Projects\FlappyShroomy\FlappyShroomy.uproject" -rocket" exited with code -1.

Did anyone fixed this problem? I use the binary 4.4 release.

Sincerely

p.s. Please don’t be scared of the “Flappy” in my project name. It’s just to learn some things with C++ and Paper2D :stuck_out_tongue:

Hi Gamixie,

Does your project depend on Paper2D? You should have it listed in your Build.cs file like so:


PublicDependencyModuleNames.AddRange(new string] { "Core", "CoreUObject", "Engine", "InputCore", "**Paper2D**" });

Cheers,
Noland

Hey !

My Build.cs looks like this:


PublicDependencyModuleNames.AddRange(new string] { "Core", "CoreUObject", "Engine", "InputCore", "Paper2D", "Slate", "SlateCore" });

So this shouldn’t be the problem.

Maybe I should add that I can compile a APaperCharacter without any problems, but nothing else that derives from Paper2D. Currently I use this for everything, but that cannot be the point. ^^

EditEdit: I tried to make a APaperSpriteActor within Blueprints and it worked out well. Maybe this is a little help too ^^

You are using the binary, right?

In the branch and master source code this issue is already solved.

You need to define the declaration of GetReferencedContentObjects.

This is the missing code in PaperSpriteActor.cpp (already fixed in master / branch 4.4)

#if WITH_EDITOR
bool APaperSpriteActor::GetReferencedContentObjects(TArray<UObject*>& Objects) const
{
if (UPaperSprite* SourceSprite = RenderComponent->GetSprite())
{
Objects.Add(SourceSprite);
}
return true;
}
#endif

Hey Dredok!

THANK YOU SO MUCH! It works now! :slight_smile:

glad it helped!