C++ Transition Guide for 4.22

Dear Community,

Yay for 4.22!

Here is a thread where you can post any issues you encounter while upgrading to 4.22, with a focus on C++ compile issues.

**VS 2017 Update**



```


WindowsPlatformCompilerSetup.h(22): error C2338: Visual Studio 2017 versions 15.7 and 15.8 are known to have code generation bugs that affect UE4. Please update to version 15.9.


```



**Solution:** Downloaded the Latest VS 2017
[https://docs.microsoft.com/en-us/vis...s2017-relnotes](https://docs.microsoft.com/en-us/visualstudio/releasenotes/vs2017-relnotes)

error C2065: ‘PST_Sync’: undeclared identifier



PxScene* PScene = PhysScene->GetPxScene(PST_Sync);


Solution



PxScene* PScene = PhysScene->GetPxScene();


Victory to You!

:heart:

Rama

Woohoo, first in :slight_smile:

I do a lot of stuff with procedural mesh components, when I try to migrate my projects into 4.22 they break because (apparently) shader core has been merged into render core.

Can some tell me how to setup the build files in 4.22 to get this working again?

I’m having problem with UWidgetAnimation specifically OnAnimationFinished_DEPRECATED. I don’t know what to use instead!

Thank you!

I had the following error when upgrading my project from 4.21:


error C3248: 'AController::Possess': function declared as 'final' cannot be overridden by 'AEnemyAI::Possess'

Where I had written a custom EnemyAI class and overridden the Possess function. In my case, simply renaming my function did the trick. So this:


virtual void Possess(APawn *InPawn) override;

Turned into this:


virtual void PossessEnemy(APawn *InPawn);

And now I have to manually call my custom possess function in my enemy’s master class BeginPlay function, so that the AI actually starts working again:


Cast<AEnemyAI>(GetController())->PossessEnemy(this);

Try using:


AController::OnPossess

This commit has nice examples if you are using ENQUEUE_UNIQUE_RENDER_COMMAND_* which is now replaced by ENQUEUE_RENDER_COMMAND:
https://github.com/EpicGames/UnrealE…d71c756a5624b0

I think we should get a separate VS2019 section of topic, since it was released just yesterday together with UE4.22.

I noticed a C4800 ERROR: Implicit conversion to bool, which should be a warning, not an error, in VS2019, not VS2017.
Since I can’t find any information it seems like this might be an Unreal specific thing, in which warnings of a certain level get treated as errors automtically and I can’t find any settings for that.

bTraceAsyncScene has been removed since Async Scene was deprecated in 4.21 and now removed in 4.22

3 Likes

Someone has created a topic for this issue here, https://forums.unrealengine.com/development-discussion/engine-source-github/1602477-c4800-implicit-conversion-from-t-to-bool-compile-error-when-using-vs2019

ReplicationGraph’s TClassMap Getter changed to use (UClass *) instead of (const UClass *)

There is a method for that now UWidgetAnimation::BindToAnimationFinished. However when I use that method to bind my event I get a link error. I will continue investigating the cause of that link error.
In the meantime the only solution that I found is to override the method OnAnimationFinished_Implementation inside my user widget and then check if the animation that finished playing is the one that I want the event for, and then I fire the event manually.

Cheers!

If your module’s folder is called ABC2, the module name now has to be ABC2, you can’t do IMPLEMENT_MODULE(SomeModule, ABC).

If you use custom material nodes and accessed the object’s Primitive structure directly (along the lines of)


Primitive.WorldToLocal


you need to replace it with a getter of primitive data on the FMaterialPixelParameters struct, like so


GetPrimitiveData(Parameters.PrimitiveId).WorldToLocal


(which the material compiler will practically spell out for you, but anyways…)

Which should do the replacement automatically for you, but don’t, give us more work to do, lol

Just go to your <Project>.Build.cs file and remove “ShaderCore” from the list of modules. Since the contents were moved to RenderCore, ShaderCore simply is no longer needed.

Thank you @Sveitar! My code is working now!

Before:


MyWidgetAnimation->OnAnimationFinished.AddDynamic(this, &UMyWidgetClass::MyAnimationFinishedEvent);

Now:


FWidgetAnimationDynamicEvent AnimationEvent;
AnimationEvent.BindDynamic(this, &UMyWidgetClass::MyAnimationFinishedEvent);

MyWidgetAnimation->BindToAnimationFinished(this, AnimationEvent);

2 Likes

Vertex factory shader parameters have changed, it appears that it’s no longer possible to directly set them in the shader param struct itself (with SetMesh).

Does anyone have a good example of a custom primitive scene proxy using a custom vertex factory in 4.22?

Ok Having several issues here,


error C2039: 'bTraceAsyncScene': is not a member of 'FCollisionQueryParams'

also


'ValueType *TClassMap<ValueType>::Get(UClass *)': cannot convert argument 1 from 'const UClass *' to 'UClass *'
1>          with
1>          
1>              ValueType=EClassRepNodeMapping
1>          ]

and finally


warning C4996: 'APlayerController::ClientPlayForceFeedback': Use version that specifies parameters using a struct instead of a list of parameters Please update your code to the new API before upgrading to the next release, otherwise your project will no longer compile.

Does somebody expirience crash after call this method?


PhysicalAnimationComponent->ApplyPhysicalAnimationProfileBelow(BoneName, ProfileName, true, true);

The reason behind this is empty array returning from skeletel mesh.


const TArray<FTransform>& SpaceBases = PhysicalAnimationComponent->GetSkeletalMesh()->GetEditableComponentSpaceTransforms();

It is not empty on BeginPlay and first Tick, but then its empty. My code was working before on versions<4.22.

Sorted out the majority of the problems, no compile issues but now I cannot actually complete the compile. The missing module IS my code so has something changed?



1>------ Build started: Project: UnrealGhosts, Configuration: Development_Editor x64 ------
1>Using 'git status' to determine working set for adaptive non-unity build (F:\Development\Unreal\SectionNine).
1>Invalidating makefile for UnrealGhostsEditor (working set of source files changed)
1>Parsing headers for UnrealGhostsEditor
1>  Running UnrealHeaderTool "F:\Development\Unreal\SectionNine\UnrealGhosts.uproject" "F:\Development\Unreal\SectionNine\Intermediate\Build\Win64\UnrealGhostsEditor\Development\UnrealGhostsEditor.uhtmanifest" -LogCmds="loginit warning, logexit warning, logdatabase error" -Unattended -WarningsAsErrors -installed
1>Reflection code generated for UnrealGhostsEditor in 11.023005 seconds
1>[Adaptive unity build] Excluded from UnrealGhosts unity file: BTDecorator_HasLoSTo.cpp, SectionNineAIController.cpp, SectionNineReplicationGraph.cpp, SectionNineCharacter.cpp, SectionNineWeapon.cpp
1>Using Visual Studio 2017 14.16.27023 toolchain (f:\Visual Studio 2017\VC\Tools\MSVC\14.16.27023) and Windows 10.0.16299.0 SDK (C:\Program Files (x86)\Windows Kits\10).
1>Building 5 actions with 4 processes...
1>  [1/5] SectionNineCharacter.cpp
1>  [2/5] Module.UnrealGhosts.cpp
1>  [3/5] UE4Editor-UnrealGhosts.lib
1>     Creating library F:\Development\Unreal\SectionNine\Intermediate\Build\Win64\UE4Editor\Development\UnrealGhosts\UE4Editor-UnrealGhosts.lib and object F:\Development\Unreal\SectionNine\Intermediate\Build\Win64\UE4Editor\Development\UnrealGhosts\UE4Editor-UnrealGhosts.exp
1>  [4/5] UE4Editor-UnrealGhosts.dll
1>     Creating library F:\Development\Unreal\SectionNine\Intermediate\Build\Win64\UE4Editor\Development\UnrealGhosts\UE4Editor-UnrealGhosts.suppressed.lib and object F:\Development\Unreal\SectionNine\Intermediate\Build\Win64\UE4Editor\Development\UnrealGhosts\UE4Editor-UnrealGhosts.suppressed.exp
1>LINK : error LNK2001: unresolved external symbol IMPLEMENT_MODULE_UnrealGhosts
1>F:\Development\Unreal\SectionNine\Binaries\Win64\UE4Editor-UnrealGhosts.dll : fatal error LNK1120: 1 unresolved externals
1>f:\Visual Studio 2017\Common7\IDE\VC\VCTargets\Microsoft.MakeFile.Targets(44,5): error MSB3075: The command ""F:\Epic Games\UE_4.22\Engine\Build\BatchFiles\Build.bat" UnrealGhostsEditor Win64 Development -Project="F:\Development\Unreal\SectionNine\UnrealGhosts.uproject" -WaitMutex -FromMsBuild" exited with code 5. Please verify that you have sufficient rights to run this command.
1>Done building project "UnrealGhosts.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========