Muokkaa

Jaa


Compiler errors C2600 Through C2699

The articles in this section of the documentation explain a subset of the error messages that are generated by the compiler.

Important

The Visual Studio compilers and build tools can report many kinds of errors and warnings. After an error or warning is found, the build tools may make assumptions about code intent and attempt to continue, so that more issues can be reported at the same time. If the tools make the wrong assumption, later errors or warnings may not apply to your project. When you correct issues in your project, always start with the first error or warning that's reported, and rebuild often. One fix may make many subsequent errors go away.

To get help on a particular diagnostic message in Visual Studio, select it in the Output window and press the F1 key. Visual Studio opens the documentation page for that error, if one exists. You can also use the search tool at the top of the page to find articles about specific errors or warnings. Or, browse the list of errors and warnings by tool and type in the table of contents on this page.

Note

Not every Visual Studio error or warning is documented. In many cases, the diagnostic message provides all of the information that's available. If you landed on this page when you used F1 and you think the error or warning message needs additional explanation, let us know. You can use the feedback buttons on this page to raise a documentation issue on GitHub. If you think the error or warning is wrong, or you've found another problem with the toolset, report a product issue on the Developer Community site. You can also send feedback and enter bugs within the IDE. In Visual Studio, go to the menu bar and choose Help > Send Feedback > Report a Problem, or submit a suggestion by using Help > Send Feedback > Send a Suggestion. Some compiler error topics were created that are not emitted by the compiler and now redirect to this page instead.

You may find additional assistance for errors and warnings in Microsoft Learn Q&A forums. Or, search for the error or warning number on the Visual Studio C++ Developer Community site. You can also search Stack Overflow to find solutions.

For links to additional help and community resources, see Visual C++ Help and Community.

Error messages

Error Message
Compiler error C2600 'function': cannot define a compiler-generated special member function (must be declared in the class first)
Compiler error C2601 'function': local function definitions are illegal
Compiler error C2602 'class::identifier' is not a member of a base class of 'class'
Compiler error C2603 'function': Too many block scope static objects with constructor/destructors in function
Compiler error C2604 'identifier': Cannot implement more than one interface method
Compiler error C2605 'identifier': this method is reserved within a managed/WinRT class
Compiler error C2606 'class1': cannot re-implement 'member', as it is inherited from runtime base 'class2'
Compiler error C2607 static assertion failed
Compiler error C2608 Obsolete.
Compiler error C2609 Obsolete.
Compiler error C2610 'class::member': is not a special member function which can be defaulted
Compiler error C2611 'token': illegal following '~' (expected identifier)
Compiler error C2612 trailing 'character' illegal in base/member initializer list
Compiler error C2613 trailing 'character' illegal in base class list
Compiler error C2614 'class': illegal member initialization: 'identifier' is not a base or member
Compiler error C2615 Obsolete.
Compiler error C2616 'conversion': cannot implicitly convert a non-lvalue 'type1' to a 'type2' that is not const
Compiler error C2617 'function': inconsistent return statement
Compiler error C2618 Obsolete.
Compiler error C2619 'identifier': a static data member is not allowed in an anonymous struct/union
Compiler error C2620 Obsolete.
Compiler error C2621 Obsolete.
Compiler error C2622 Obsolete.
Compiler error C2623 Obsolete.
Compiler error C2624 'scope::type': local classes cannot be used to declare 'extern' variables
Compiler error C2625 'identifier': illegal union member; type 'type' is reference type
Compiler error C2626 'identifier': a private/protected data member is not allowed in an anonymous struct/union
Compiler error C2627 'function': member function not allowed in anonymous union
Compiler error C2628 'type1' followed by 'type2' is illegal (did you forget a ';'?)
Compiler error C2629 'identifier': an anonymous struct/union cannot declare a nested type
Compiler error C2630 'symbol' found in what should be a comma-separated list
Compiler error C2631 'identifier': a class or enum cannot be defined in an alias template
Compiler error C2632 'type1' followed by 'type2' is illegal
Compiler error C2633 'identifier': 'inline' is the only legal storage class for constructors
Compiler error C2634 'class::member': pointer to reference member is illegal
Compiler error C2635 cannot convert a 'type1*' to a 'type2*'; conversion from a virtual base class is implied
Compiler error C2636 'identifier': pointer to reference member is illegal
Compiler error C2637 'identifier': cannot modify pointers to data members
Compiler error C2638 'identifier': __based modifier illegal on pointer to member
Compiler error C2639 Obsolete.
Compiler error C2640 'identifier': __based modifier illegal on reference
Compiler error C2641 Obsolete.
Compiler error C2642 Obsolete.
Compiler error C2643 Obsolete.
Compiler error C2644 Obsolete.
Compiler error C2645 no qualified name for pointer to member (found ':: *')
Compiler error C2646 an anonymous struct/union at global or namespace scope must be declared static
Compiler error C2647 'operator': cannot dereference a 'type1' on a 'type2'
Compiler error C2648 'identifier': use of member as default parameter requires static member
Compiler error C2649 'identifier': is not a 'class/struct/union'
Compiler error C2650 'operator': cannot be a virtual function
Compiler error C2651 'type': left of '::' must be a class, struct or union
Compiler error C2652 'identifier': illegal copy constructor: first parameter must not be a 'type'
Compiler error C2653 'identifier': is not a class or namespace name
Compiler error C2654 'identifier': attempt to access member outside a member function
Compiler error C2655 'identifier': definition or redeclaration illegal in current scope
Compiler error C2656 'function': function not allowed as a bit field
Compiler error C2657 'class::*' found at the start of a statement (did you forget to specify a type?)
Compiler error C2658 'identifier': redefinition in anonymous struct/union
Compiler error C2659 'operator': function as left operand
Compiler error C2660 'function': function does not take number arguments
Compiler error C2661 'function': no overloaded function takes number arguments
Compiler error C2662 'function': cannot convert 'this' pointer from 'type1' to 'type2'
Compiler error C2663 'function': number overloads have no legal conversion for 'this' pointer
Compiler error C2664 'function': cannot convert argument number from 'type1' to 'type2'
Compiler error C2665 'function': none of the number overloads could convert all the argument types
Compiler error C2666 'function': number overloads have similar conversions
Compiler error C2667 'function': none of number overloads have a best conversion
Compiler error C2668 'function': ambiguous call to overloaded function
Compiler error C2669 member function not allowed in anonymous union
Compiler error C2670 'function': the function template cannot convert parameter number from type 'type'
Compiler error C2671 'function': static member functions do not have 'this' pointers
Compiler error C2672 'function': no matching overloaded function found
Compiler error C2673 'function': global functions do not have 'this' pointers
Compiler error C2674 a generic declaration is not allowed in this context
Compiler error C2675 unary 'operator': 'type' does not define this operator or a conversion to a type acceptable to the predefined operator
Compiler error C2676 binary 'operator': 'type' does not define this operator or a conversion to a type acceptable to the predefined operator
Compiler error C2677 binary 'operator': no global operator found which takes type 'type' (or there is no acceptable conversion)
Compiler error C2678 binary 'operator': no operator found which takes a left-hand operand of type 'type' (or there is no acceptable conversion)
Compiler error C2679 binary 'operator': no operator found which takes a right-hand operand of type 'type' (or there is no acceptable conversion)
Compiler error C2680 'type': invalid target type for cast
Compiler error C2681 'type': invalid expression type for cast
Compiler error C2682 cannot use 'cast' to convert from 'type1' to 'type2'
Compiler error C2683 'cast': 'type' is not a polymorphic type
Compiler error C2684 'declarator': deleted and defaulted functions are not supported in managed/WinRT classes
Compiler error C2685 'declarator': deleted and defaulted functions are not supported with explicit restriction specifiers
Compiler error C2686 cannot overload static and non-static member functions with the same parameter types
Compiler error C2687 'type': exception-declaration cannot be 'void' or denote an incomplete type or pointer or reference to an incomplete type
Compiler error C2688 'type::member': covariant returns with multiple or virtual inheritance not supported for varargs functions
Compiler error C2689 'function': a friend function cannot be defined within a local class
Compiler error C2690 'operator': cannot perform pointer arithmetic on a managed/WinRT array
Compiler error C2691 'type': a managed/WinRT array cannot have this element type
Compiler error C2692 'function': fully prototyped functions required in C compiler with the '/clr' option
Compiler error C2693 'operator': illegal comparison for references to a managed/WinRT array
Compiler error C2694 'override_function': overriding virtual function has less restrictive exception specification than base class virtual member function 'base_function'
Compiler error C2695 'override_function': overriding virtual function differs from 'base_function' only by calling convention
Compiler error C2696 Cannot create a temporary object of managed/WinRT type 'type'
Compiler error C2697 Obsolete.
Compiler error C2698 the using-declaration for 'declaration1' cannot co-exist with the existing using-declaration for 'declaration2'

See also

C/C++ Compiler and build tools errors and warnings
Compiler errors C2000 - C3999, C7000 - C7999