Use UE4 APIs instead of standard C++ Standard libery. This way threads will be visible by engine and they will show up in UE4 profiler. Here you got basic tutorial:
UE4 has a lot of standard API wrapped up and by using those wrappers you sure that you code will build and run on any platfrom that UE4 supports as well as they be managed by UE4. So search for functions in UE4 APIs first and if you don’t find anything try using other APIs
The error it self seems to be cause by compiler options, which are managed by UBT. But i don’t think there way to set up in UBT, maybe in UBT configs in saved