UE4.15 FObjectFinder compile error

Hi,
I have moved to UE4.15, FObjectFinder whith UPaperFlipbook gives a compile error.
to regerenate this error:

  1. created new c++ sidescroller project

  2. add the following lines to the character constructor, then compile

    static ConstructorHelpers::FObjectFinder IdleAnimationObj(TEXT("/Game/2dSideScroller/Sprites/IdleAnimation.IdleAnimation"));
    IdleAnimation = IdleAnimationObj.Object;
    static ConstructorHelpers::FObjectFinder RunningAnimationObj(TEXT("/Game/2dSideScroller/Sprites/RunningAnimation.RunningAnimation"));
    RunningAnimation = RunningAnimationObj.Object;

the compile error I got is:

1>------ Build started: Project: test4, Configuration: Development_Editor x64 ------
1>  Compiling game modules for hot reload
1>  Performing 3 actions (3 in parallel)
1>  test4Character.cpp
1>c:\program files\epic games\ue_4.15\engine\source\runtime\coreuobject\public\UObject/ConstructorHelpers.h(109): error C2664: 'void ConstructorHelpers::ValidateObject(UObject *,const FString &,const TCHAR *)': cannot convert argument 1 from 'UPaperFlipbook *' to 'UObject *'
1>  c:\program files\epic games\ue_4.15\engine\source\runtime\coreuobject\public\UObject/ConstructorHelpers.h(109): note: Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>  c:\program files\epic games\ue_4.15\engine\source\runtime\coreuobject\public\UObject/ConstructorHelpers.h(102): note: while compiling class template member function 'ConstructorHelpers::FObjectFinder<UPaperFlipbook>::FObjectFinder(const TCHAR *)'
1>  C:\Users\userO\Documents\Unreal Projects\test4\Source\test4\test4Character.cpp(17): note: see reference to function template instantiation 'ConstructorHelpers::FObjectFinder<UPaperFlipbook>::FObjectFinder(const TCHAR *)' being compiled
1>  C:\Users\userO\Documents\Unreal Projects\test4\Source\test4\test4Character.cpp(17): note: see reference to class template instantiation 'ConstructorHelpers::FObjectFinder<UPaperFlipbook>' being compiled
1>ERROR : UBT error : Failed to produce item: C:\Users\userO\Documents\Unreal Projects\test4\Binaries\Win64\UE4Editor-test4-4772.dll
1>  Total build time: 1.79 seconds (Local executor: 0.00 seconds)
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.MakeFile.Targets(37,5): error MSB3075: The command ""C:\Program Files\Epic Games\UE_4.15\Engine\Build\BatchFiles\Build.bat" test4Editor Win64 Development "C:\Users\userO\Documents\Unreal Projects\test4\test4.uproject" -waitmutex" exited with code 5. Please verify that you have sufficient rights to run this command.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

thank you

Hello nanashi88,

Thank you for reporting this issue. I’ve confirmed the behavior and entered a bug report for this. You can find and track the report here: UE-42227

Have a nice day!

Edit: UE-42227 is being closed as invalid as this isn’t an issue with FObjectFinder. This seems to be an include issue. You can currently get this working by including PaperFlipbook.h in your class. I’m going to look into where this include stopped being added to see if anything else needs to be bugged.

Edit2: From looking into this, the include was removed and replaced with more specific includes as part of the massive include sweep meant to reduce compile times. The workaround of including PaperFlipbook.h will need to become to official solution to this issue.

That solves it. Thank you

Mathew J!!! omg this fixed my perpetually failing rebuild when switching to 4.17! I lost 2 days to this error, thank you!