C2679: Binary Operator – No Operator Found Taking ‘type’ as Right-Hand Operand in UE5 – What It Means & How to Fix It
🧠 Why You’re Seeing This Error
The C2679 error means you’re trying to use a binary operator (like +
, -
, =
, ==
, etc.) with a type that doesn’t support it — at least not in the way you’ve written it.
In UE5, this usually happens when:
- You try to
+
two types that don’t define how to be added (likeFVector + FString
) - You mix UE5 types (like
FString
orFName
) with regular strings (const char*
) - You use operators incorrectly on classes or pointers
- You forget to wrap string literals in
TEXT()
when working withFString
💥 Example Error Message
error C2679: binary '+' : no operator found which takes a right-hand operand of type 'const char [7]' (or there is no acceptable conversion)
🛠️ Example Code
FString PlayerName = "Player" + FString("One"); // ❌ C2679
UE5 doesn’t know how to +
a string literal ("Player"
) with an FString
.
✅ How to Fix C2679 in UE5 – Step-by-Step
✔️ 1. Wrap String Literals in TEXT()
and Convert to FString
Fix:
FString PlayerName = FString(TEXT("Player")) + FString(TEXT("One")); // ✅
Or shorter:
FString PlayerName = TEXT("Player") + FString("One");
✔️ 2. Avoid Mixing Types Like FVector + FString
These types aren’t meant to be used together. If you’re logging or building strings, convert types explicitly.
Wrong:
FVector Pos = GetActorLocation();
FString Log = "Location: " + Pos; // ❌ Can't add FString + FVector
Fix:
FVector Pos = GetActorLocation();
FString Log = "Location: " + Pos.ToString(); // ✅ Convert FVector to FString
✔️ 3. Use operator+
Correctly for Custom Types
If you’re working with your own structs or classes and want to use operators like +
, you’ll need to define them yourself.
Fix (inside your struct):
MyStruct operator+(const MyStruct& Other) const
{
MyStruct Result;
// logic here...
return Result;
}
✅ Summary: How to Fix C2679 in UE5
Cause | Fix Example |
---|---|
Mixing const char* with FString | Wrap literals with TEXT() or convert with FString() |
Using incompatible types with + | Convert to compatible types (e.g., ToString() ) |
Custom struct needs operator support | Overload the operator+ in your struct/class |