Muokkaa

Jaa


Compiler errors C2200 through C2299

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 C2200 'function': function has already been defined
Compiler error C2201 'identifier': must have external linkage in order to be exported/imported
Compiler error C2202 'function': not all control paths return a value
Compiler error C2203 delete operator cannot specify bounds for an array
Compiler error C2204 'type': type definition found within parentheses
Compiler error C2205 'identifier': cannot initialize extern variables with block scope
Compiler error C2206 'function': typedef cannot be used for function definition
Compiler error C2207 'member': a member of a class template cannot acquire a function type
Compiler error C2208 'type': no members defined using this type
Compiler error C2209 'identifier': aliases cannot be used in constructor declarations
Compiler error C2210 'identifier': pack expansions cannot be used as arguments to non-packed parameters in alias templates
Compiler error C2211 A non-virtual destructor in a ref class derived from a ref class with a public destructor must also be public
Compiler error C2212 'identifier': __based not available for pointers to functions
Compiler error C2213 'identifier': illegal argument to __based
Compiler error C2214 pointers based on 'void' require the use of:>
Compiler error C2215 'keyword' cannot be used with '/arch:SSE'
Compiler error C2216 'keyword1' cannot be used with 'keyword2'
Compiler error C2217 'attribute1' requires 'attribute2'
Compiler error C2218 'calltype' cannot be used with '/arch:IA32'
Compiler error C2219 syntax error: type qualifier must be after '*'
Compiler error C2220 warning treated as error - no 'filetype' file generated
Compiler error C2221 Obsolete.
Compiler error C2222 unexpected type 'type': a base-class or member was expected
Compiler error C2223 left of '->identifier' must point to struct/union
Compiler error C2224 left of '.identifier' must have struct/union type
Compiler error C2225 Obsolete.
Compiler error C2226 syntax error: unexpected type 'type'
Compiler error C2227 left of '->identifier' must point to class/struct/union/generic type
Compiler error C2228 left of '.identifier' must have class/struct/union
Compiler error C2229 class/struct/union 'type' has an illegal zero-sized array
Compiler error C2230 could not find module 'name'
Compiler error C2231 '.identifier': left operand points to 'class/struct/union', use '->'
Compiler error C2232 '->identifier': left operand has 'class/struct/union' type, use '.'
Compiler error C2233 'identifier': arrays of objects containing zero-size arrays are illegal
Compiler error C2234 identifier': arrays of references are illegal
Compiler error C2235 Obsolete.
Compiler error C2236 unexpected token 'token'. Did you forget a ';'?
Compiler error C2237 multiple module declaration
Compiler error C2238 unexpected token(s) preceding 'token'
Compiler error C2239 'function': attempting to delete a __declspec(dllexport) function
Compiler error C2240 Obsolete.
Compiler error C2241 'identifier': member access is restricted
Compiler error C2242 typedef name cannot follow class/struct/union
Compiler error C2243 'conversion_type': conversion from 'type1' to 'type2' exists, but is inaccessible
Compiler error C2244 'identifier': unable to match function definition to an existing declaration
Compiler error C2245 non-existent member function 'function' specified as friend (member function signature does not match any overload)
Compiler error C2246 'identifier': illegal static data member in locally defined class
Compiler error C2247 'identifier' not accessible because 'class1' uses 'specifier' to inherit from 'class2'
Compiler error C2248 'identifier': cannot access accessibility member declared in class 'class'
Compiler error C2249 'identifier': no accessible path to accessibility member declared in virtual base 'class'
Compiler error C2250 'identifier': ambiguous inheritance of class::member'
Compiler error C2251 namespace 'namespace' does not have a member 'identifier' - Did you mean 'member'?
Compiler error C2252 an explicit instantiation of a template can only occur at namespace scope
Compiler error C2253 'function': pure specifier or abstract override specifier only allowed on virtual function
Compiler error C2254 'function': pure specifier or abstract override specifier not allowed on friend function
Compiler error C2255 'element': not allowed outside of a class definition
Compiler error C2256 illegal use of friend specifier on 'function'
Compiler error C2257 'specifier': specifier not allowed in trailing return type
Compiler error C2258 illegal pure syntax, must be '= 0'
Compiler error C2259 'class': cannot instantiate abstract class
Compiler error C2260 'specifier': invalid InternalsVisibleToAttribute friend assembly specifier
Compiler error C2261 'string': assembly reference is invalid and cannot be resolved
Compiler error C2262 'specifier': InternalsVisibleTo declarations cannot have a version, culture, or processor architecture specified
Compiler error C2263 Obsolete.
Compiler error C2264 'function': error in function definition or declaration; function not called
Compiler error C2265 Obsolete.
Compiler error C2266 'identifier': reference to a non-constant bounded array is illegal
Compiler error C2267 'function': static functions with block scope are illegal
Compiler error C2268 'function' is a compiler predefined library helper. Library helpers are not supported with /GL; compile object file 'filename' without /GL.
Compiler error C2269 cannot create a pointer or reference to a qualified function type (requires pointer-to-member)
Compiler error C2270 'function': modifiers not allowed on nonmember functions
Compiler error C2271 'function': new/delete cannot have formal list modifiers
Compiler error C2272 'function': modifiers not allowed on static member functions
Compiler error C2273 'type': illegal as right side of '->' operator
Compiler error C2274 'type': illegal as right side of '.' operator
Compiler error C2275 'type': illegal use of this type as an expression
Compiler error C2276 'operator': illegal operation on bound member function expression
Compiler error C2277 'function': cannot take address of this member function
Compiler error C2278 Obsolete.
Compiler error C2279 exception specification cannot appear in a typedef declaration
Compiler error C2280 'class::function': attempting to reference a deleted function
Compiler error C2281 'class::function': a function can only be deleted on the first declaration
Compiler error C2282 'function1' cannot override 'function2'
Compiler error C2283 'identifer': pure specifier or abstract override specifier not allowed on unnamed class/struct
Compiler error C2284 'function': illegal argument to intrinsic function, parameter number
Compiler error C2285 pointers to members representation has already been determined - pragma ignored
Compiler error C2286 pointers to members of 'identifier' representation is already set to inheritance - declaration ignored
Compiler error C2287 'identifier': inheritance representation: 'inheritiance' is less general than the required 'inheritance'
Compiler error C2288 Obsolete.
Compiler error C2289 same type qualifier used more than once
Compiler error C2290 C++ 'asm' syntax ignored. Use __asm.
Compiler error C2291 An anonymous namespace cannot be exported.
Compiler error C2292 'identifier': best case inheritance representation: inheritance1' declared but 'inheritance2' required
Compiler error C2293 'identifier': illegal to have a member variable as a __based specifier
Compiler error C2294 cannot export symbol 'identifier' because it has internal linkage
Compiler error C2295 escaped 'character': is illegal in macro definition
Compiler error C2296 'operator': illegal, left operand has type 'type'
Compiler error C2297 'operator': illegal, right operand has type 'type'
Compiler error C2298 missing call to bound pointer to member function
Compiler error C2299 'function': behavior change: an explicit specialization cannot be a copy constructor or copy assignment operator

See also

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