What's needed for using C++17

As usual spent 2h for discovery of something which just may as well be written to begin with. So UE 4.22 + VS2019:

Edit the $project\Source$project$project.Build.cs file



PCHUsage = PCHUsageMode.NoSharedPCHs;
PrivatePCHHeaderFile = "$pch.h";
CppStandard = CppStandardVersion.Cpp17;


Where $project and $pch should be substituted with something to match your application. Technically, the custom PCH is not needed but since UE 4.21 the UE build tool wants it. Of course, this file must be created if it does not exist and can be filled in with whatever headers make sense.

Another annoyance is IntelliSense which wont get that the project is based on C++17 so I digged out the idea that you can go to Project Properties -> NMake -> Additional Options and add /std:c++17

This whole thing allowed me to use c++17 language features and part of the STL, I havent tried yet any runtime dependecies like using new (incl. vector, thread) and stuff.

Good luck with the rest!

4 Likes