What It Means & How to Fix It
🧠 Why You’re Seeing This Error
C2663 means you’re trying to call a function with the wrong number of arguments, or from the wrong context (like a const object calling a non-const method).
In UE5, this often happens when:
- You call a method with too many or too few parameters
- You forget to mark the method
const
, but call it on a const object - You’re calling a method on a type Unreal or C++ doesn’t recognize (e.g., using
.
instead of->
)
💥 Example Error Message
error C2663: 'FString AMyActor::GetName()': function does not take 1 arguments
🛠️ Example Code
FString Name = GetName(TEXT("Player")); // ❌ C2663: method takes 0 arguments
But in the class definition:
FString GetName() const; // no parameters
✅ How to Fix C2663 in UE5 – Step-by-Step
✔️ 1. Match the Number of Arguments
Check the header to make sure your arguments match exactly — even one extra will trigger C2663.
Fix:
FString Name = GetName(); // ✅ No arguments now match
✔️ 2. If the Error Mentions const
, Match Const-ness
C2663 can also show up if you’re calling a non-const method from a const function.
Fix:
FString GetName() const; // ✅ Method is now callable in const contexts
✔️ 3. Check for Static vs Instance Method Mismatch
Calling a non-static function like it’s static will confuse the compiler.
Wrong:
AMyActor::GetName(); // ❌ GetName is not static
Fix:
MyActor->GetName(); // ✅
✅ Summary: How to Fix C2663 in UE5
Cause | Fix Example |
---|---|
Wrong number of arguments | Match the header declaration |
Calling non-const from const | Mark method const |
Misusing instance vs static call | Use object pointer to call non-static functions |