Muokkaa

Jaa


Compiler errors C2700 Through C2799

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 C2700 'type': cannot be thrown (use /W4 for more info)
Compiler error C2701 'function': a function template/generic cannot be a friend of a local class
Compiler error C2702 __except may not appear in termination block
Compiler error C2703 illegal __leave statement
Compiler error C2704 'function': __va_start intrinsic only allowed in varargs
Compiler error C2705 'label': illegal jump into 'exception_block' scope
Compiler error C2706 illegal __except without matching __try (missing '}' in __try block?)
Compiler error C2707 'identifier': bad context for intrinsic function
Compiler error C2708 'identifier': actual parameters length in bytes differs from previous call or reference
Compiler error C2709 'identifier': formal parameters length in bytes differs from previous declaration
Compiler error C2710 'identifier': '__declspec(modifier)' can only be applied to a function returning a pointer
Compiler error C2711 'function': this function cannot be compiled as managed, consider using #pragma unmanaged
Compiler error C2712 Cannot use __try in functions that require object unwinding
Compiler error C2713 Only one form of exception handling permitted per function
Compiler error C2714 alignof(void) is not allowed
Compiler error C2715 'type': cannot throw or catch this type
Compiler error C2716 Obsolete.
Compiler error C2717 Obsolete.
Compiler error C2718 'type': actual parameter with requested alignment of number won't be aligned
Compiler error C2719 'parameter': formal parameter with requested alignment of number won't be aligned
Compiler error C2720 'identifier': 'specifier' storage-class specifier illegal on members
Compiler error C2721 'specifier': storage-class specifier illegal between operator keyword and type
Compiler error C2722 '::operator': illegal following operator command; use 'operator operator'
Compiler error C2723 'function': 'specifier' specifier illegal on function definition
Compiler error C2724 'function': 'static' should not be used on member functions defined at file scope
Compiler error C2725 'type': unable to throw or catch a managed/WinRT object by value or reference
Compiler error C2726 'gcnew' may only be used to create an object with managed/WinRT type
Compiler error C2727 Obsolete.
Compiler error C2728 'type': a native array cannot contain this type
Compiler error C2729 Obsolete.
Compiler error C2730 'class': cannot be a base class of itself
Compiler error C2731 'function': function cannot be overloaded
Compiler error C2732 linkage specification contradicts earlier specification for 'function'
Compiler error C2733 'function': second C linkage of overloaded function not allowed
Compiler error C2734 'identifier': 'const' object must be initialized if not 'extern'
Compiler error C2735 'keyword' keyword is not permitted in formal parameter type specifier
Compiler error C2736 'keyword' keyword is not permitted in cast
Compiler error C2737 'identifier': const/constexpr object must be initialized
Compiler error C2738 'operator type': is ambiguous or is not a member of 'class'
Compiler error C2739 'number': explicit managed/WinRT array dimensions must be between 1 and 32
Compiler error C2740 value of operand 'number' is out of range 'lower_bound - upper_bound'
Compiler error C2741 frame size too large
Compiler error C2742 Obsolete.
Compiler error C2743 'type': cannot catch a native type with __clrcall destructor or copy constructor
Compiler error C2744 'operator' is not a valid CLR/WinRT operator
Compiler error C2745 'token': this token cannot be converted to an identifier
Compiler error C2746 Obsolete.
Compiler error C2747 Obsolete.
Compiler error C2748 managed/WinRT array creation must have array size or array initializer
Compiler error C2749 'type': can only throw or catch handle to a managed class with /clr:safe
Compiler error C2750 'type': cannot use 'new' on the reference type; use 'gcnew' instead
Compiler error C2751 'parameter': the name of a function parameter cannot be qualified
Compiler error C2752 'template': more than one partial specialization matches the template argument list
Compiler error C2753 'template': partial specialization cannot match argument list for primary template
Compiler error C2754 'template': a partial specialization cannot have a dependent non-type template parameter
Compiler error C2755 'parameter': non-type parameter of a partial specialization must be a simple identifier
Compiler error C2756 'template': default template arguments not allowed on a partial specialization
Compiler error C2757 'identifier': a symbol with this name already exists and therefore this name cannot be used as a namespace name
Compiler error C2758 'member': a member of reference type must be initialized
Compiler error C2759 in-line assembler reports: error_message
Compiler error C2760 syntax error: expected 'token1' not 'token2'
Compiler error C2761 'function': member function redeclaration not allowed
Compiler error C2762 'template': invalid expression as a template argument for 'parameter'
Compiler error C2763 'template': invalid use of a string literal as a template argument for 'parameter'
Compiler error C2764 'parameter': template parameter not used or deducible in partial specialization 'specialization'
Compiler error C2765 'function': an explicit specialization of a function template cannot have any default arguments
Compiler error C2766 explicit specialization; 'specialization' has already been defined
Compiler error C2767 managed/WinRT array dimension mismatch: expected number argument(s) - number provided
Compiler error C2768 'function': illegal use of explicit template arguments
Compiler error C2769 you cannot brace initialize a managed/WinRT array in a base/member initializer list
Compiler error C2770 invalid explicit template/generic argument(s) for 'template'
Compiler error C2771 #import only permitted at global or namespace scope
Compiler error C2772 Obsolete.
Compiler error C2773 #import and #using available only in C++ compiler
Compiler error C2774 'identifier': no 'put' method is associated with this property
Compiler error C2775 'identifier': no 'get' method is associated with this property
Compiler error C2776 only one 'get' method can be specified per property
Compiler error C2777 only one 'put' method can be specified per property
Compiler error C2778 improperly formed GUID in __declspec(uuid())
Compiler error C2779 'declaration': property methods can only be associated with non-static data members
Compiler error C2780 'declaration': expects number arguments - number provided
Compiler error C2781 'declaration': expects at least number argument - number provided
Compiler error C2782 'declaration': template/generic parameter 'parameter' is ambiguous
Compiler error C2783 'declaration': could not deduce template/generic argument for 'identifier'
Compiler error C2784 'declaration': could not deduce template/generic argument for 'type1' from 'type2'
Compiler error C2785 'declaration1' and 'declaration2' have different return types
Compiler error C2786 'type': invalid operand for __uuidof
Compiler error C2787 'identifier': no GUID has been associated with this object
Compiler error C2788 'identifier': more than one GUID associated with this object
Compiler error C2789 'identifier': an object of const-qualified type must be initialized
Compiler error C2790 'super': this keyword can only be used within the body of class member function
Compiler error C2791 illegal use of 'super': 'class' does not have any base classes
Compiler error C2792 'super': this keyword must be followed by '::'
Compiler error C2793 'token': unexpected token following '::', identifier or keyword 'operator' expected
Compiler error C2794 'identifier': is not a member of any direct or indirect base class of 'class'
Compiler error C2795 'super::identifier' is not a member function
Compiler error C2796 'ref new' may only be used to create an instance of a WinRT type
Compiler error C2797 (Obsolete) 'identifier': list initialization inside member initializer list or non-static data member initializer is not implemented
Compiler error C2798 'super::identifier' is ambiguous
Compiler error C2799 'identifier': an object of const-qualified class type without a user-provided default constructor must be initialized

See also

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