C2660
Visual C++ Programming Language
Severity: MinorWhat Does This Error Mean?
C2660 means a function is called with a different number of arguments than its definition or declaration requires. The message reads: C2660: 'FunctionName': function does not take 2 arguments. Either the function call is passing too many or too few arguments, or you are calling a different overload than you intended.
Affected Models
- Visual Studio 2015–2022
- MSVC v14.x / v17.x
Common Causes
- Passing more or fewer arguments than the function's parameter list requires
- Calling the wrong function overload — a version with a different parameter count exists
- A function signature was changed (parameter added or removed) but not all call sites were updated
- Calling a function via a wrong function pointer type
- A macro that expands the function name or argument list unexpectedly
How to Fix It
-
Right-click the function name in Visual Studio and choose Go to Definition to see the exact parameter list the function expects.
Count the parameters in the definition and compare them to the arguments in your call. The error message tells you how many arguments your call passes and how many the function accepts.
-
If the function signature was recently changed, update all call sites to match the new parameter list. Use Find All References (Shift+F12) in Visual Studio to locate every call.
A single parameter added to a widely-used function generates C2660 at every call site. Find All References shows every location that needs updating.
-
If multiple overloads exist, verify you are calling the intended version. Check the overload set in the header to find the correct argument types and count.
IntelliSense in Visual Studio shows the available overloads as a tooltip when you type a function call. Press Ctrl+Shift+Space inside a function call to bring up the parameter hint.
Frequently Asked Questions
How do I add optional parameters to a C++ function?
Use default parameter values in the function declaration: void Foo(int x, int y = 0); Callers can then omit y and it defaults to 0. Default parameters must appear at the end of the parameter list.
Can C2660 be caused by a missing #include?
Yes — if the correct header is missing, the compiler may see an older or incomplete declaration of the function with a different parameter list. Including the correct header shows the compiler the right signature and clears C2660.