When compiling C++ I get engine error

I often encounter a similar error when using UE_LOG and mistakenly omitting the asterisk (*) before an FString. For instance, I’ve run into issues like so:

FString Text = TEXT("Hello");
UE_LOG(LogTemp, Warning, TEXT("%s"), Text);

This results in an error because UE_LOG expects a const TCHAR* type for string formatting, but Text is an FString. The correct way to pass FString to UE_LOG is by using the * operator to convert FString to const TCHAR*, like so:

UE_LOG(LogTemp, Warning, TEXT("%s"), *Text);

Adding the asterisk before Text correctly formats the string and may be a solution similar to the one you are looking for.