Ue5 C++ Upgrade Tips

Hey everyone, I thought I’d share some of my findings when trying to migrate my project from UE4 to UE5. It seems like the compiler is a bit more strict than it was in UE4, so let’s all post tips and solutions we’ve found to satisfy the new requirements of the compiler.

What I’ve found so far:

  • “Ambiguous Arguments” means you have to explicitly cast arguments to the specified type, such as int to float like (float)64 or 64.f
  • “No discard” means the compiler expects you to save the return value. Just save it to a variable.

iTween : Free, smooth, procedural object animation
easyCSV : Read data from any CSV and put them in an easy-to-access string map!
Runtime DataTable : Import and export game data to and from CSV or Google Sheets while your game is running!

1 Like

No discard is an annotation for your own benefit. Those functions do not have side-effects and so if you weren’t using the return value it is wasted effort. Many of the functions it was added to are string related and likely indicated an unintentional use of a function that returns the result where the user thought it was modifying the value passed in.

Thanks for the tip Marc, that makes sense!

I was using a source build of UE4 in order to use C++17. I deleted my server target.cs and commented out the custom target types in the projectname.target.cs file. I also had to remove an else if (Target.Platform == UnrealTargetPlatform.Win32) because it didn’t recognize the Win32 in the build.cs (because they don’t support it any more of course :slight_smile: ).

After I did that the project successfully migrated but will crash on launch with an RHI error right at 75% when launching from the uproject file (same thing when launching debug from VS).

Exception thrown at 0x00007FFCF7C655BA (UnrealEditor-RHI.dll) in UnrealEditor.exe: 0xC0000005: Access violation reading location 0x0000000000000110.