Compiler errors C2400 Through C2499

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.

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 C2400 inline assembler syntax error in 'context'; found 'token'
Compiler error C2401 'identifier': register must be base in 'context'
Compiler error C2402 'identifier': register must be index in 'context'
Compiler error C2403 'identifier': register must be base/index in 'context'
Compiler error C2404 'identifier': illegal register in 'context'
Compiler error C2405 illegal short forward reference with offset
Compiler error C2406 'identifier': name undefined in 'context'
Compiler error C2407 illegal 'float' register in 'context'
Compiler error C2408 illegal type on PTR operator in 'context'
Compiler error C2409 illegal type used as operator in 'context'
Compiler error C2410 'identifier': ambiguous member name in 'context'
Compiler error C2411 'identifier': illegal struct/union member in 'context'
Compiler error C2412 'label': case-insensitive label redefined
Compiler error C2413 'identifier': illegal align size
Compiler error C2414 illegal number of operands
Compiler error C2415 improper operand type
Compiler error C2416 attribute 'attribute' cannot be applied in this context
Compiler error C2417 divide by zero in 'context'
Compiler error C2418 cannot delete browser file: filename
Compiler error C2419 mod by zero in 'context'
Compiler error C2420 'identifier': illegal symbol in context
Compiler error C2421 PTR operator used with register in 'context'
Compiler error C2422 illegal segment override in 'context'
Compiler error C2423 'number': illegal scale
Compiler error C2424 'token': improper expression in 'context'
Compiler error C2425 'token': non-constant expression in 'context'
Compiler error C2426 'token': illegal operator in 'context'
Compiler error C2427 'class': cannot define class in this scope
Compiler error C2428 'operation': not allowed on operand of type 'bool'
Compiler error C2429 'language feature' requires compiler flag 'compiler option'
Compiler error C2430 more than one index register in 'context'
Compiler error C2431 illegal index register in 'context'
Compiler error C2432 illegal reference to 16-bit data in 'context'
Compiler error C2433 'identifier': 'modifier' not permitted on data declarations
Compiler error C2434 'symbol': a symbol declared with __declspec(process) cannot be dynamically initialized in /clr:pure mode
Compiler error C2435 'var': dynamic initialization requires managed CRT, cannot compile with /clr:safe
Compiler error C2436 'identifier': member function or nested class in constructor initializer list
Compiler error C2437 'identifier': has already been initialized
Compiler error C2438 'identifier': cannot initialize static class data via constructor
Compiler error C2439 'identifier': member could not be initialized
Compiler error C2440 'conversion': cannot convert from 'type_1' to 'type_2'
Compiler error C2441 'variable': a symbol declared with __declspec(process) must be const in /clr:pure mode
Compiler error C2442 'identifier': nested-namespace-definition cannot be inline or have attributes
Compiler error C2443 operand size conflict
Compiler error C2444 'identifier': used ANSI prototype, found 'type', expected '{' or ';'
Compiler error C2446 'operator': no conversion from 'type_1' to 'type_2'
Compiler error C2447 '{': missing function header (old-style formal list?)
Compiler error C2448 'identifier': function-style initializer appears to be a function definition
Compiler error C2449 found '{' at file scope (missing function header?)
Compiler error C2450 switch expression of type 'type' is illegal
Compiler error C2451 conditional expression of type 'type' is illegal
Compiler error C2452 'type': invalid source type for safe_cast
Compiler error C2453 'type': invalid target type for safe_cast
Compiler error C2454 'identifier': namespace alias name cannot be declared using a qualified name
Compiler error C2455 'class' a WinRT ref class that derives from an imported base class cannot be abstract.
Compiler error C2456 'class' an unsealed ref class cannot have a public visible constructor. Seal the class, or specify constructor as 'internal', 'protected private' or 'private' instead.
Compiler error C2457 'identifier': predefined macro cannot appear outside of a function body
Compiler error C2458 'identifier': redefinition within definition
Compiler error C2459 'identifier': is being defined; cannot add as an anonymous member
Compiler error C2460 'identifier_1': uses 'identifier_2', which is being defined
Compiler error C2461 'class': constructor syntax missing formal parameters
Compiler error C2462 'identifier': cannot define a type in a 'new-expression'
Compiler error C2464 'type': cannot use 'new' to allocate a reference
Compiler error C2465 cannot define an anonymous type inside parentheses
Compiler error C2466 cannot allocate an array of constant size 0
Compiler error C2467 illegal declaration of anonymous 'user_defined_type'
Compiler error C2468 constructor cannot be 'constexpr' in a class or struct with virtual base classes
Compiler error C2469 'new': cannot allocate 'void' objects
Compiler error C2470 'function': looks like a function definition, but there is no parameter list; skipping apparent body
Compiler error C2471 cannot update program database 'filename'
Compiler error C2472 'function' cannot be generated in managed code: 'message'; compile with /clr to generate a mixed image
Compiler error C2473 'identifier': looks like a function definition, but there is no parameter list.
Compiler error C2474 'identifier': missing an adjacent semicolon, could be either keyword or identifier.
Compiler error C2475 'identifier': redefinition; 'constexpr' specifier mismatch
Compiler error C2477 'member': static data member cannot be initialized via derived class
Compiler error C2478 declaration is incompatible with 'instance'
Compiler error C2479 'identifier': 'allocate( )' is only valid for data items of static extent
Compiler error C2480 'identifier': 'thread' is only valid for data items of static extent
Compiler error C2481 'identifier': thread_local is only valid on static members and variables at namespace or block scope
Compiler error C2482 'identifier': dynamic initialization of thread local data not allowed in managed/WINRT code
Compiler error C2483 'identifier': object with destructor or non-aggregate type cannot be declared with thread storage duration in managed/WINRT code
Compiler error C2485 'identifier': unrecognized extended attribute
Compiler error C2486 '__LOCAL_SIZE' only allowed in function with the 'naked' attribute
Compiler error C2487 'identifier': member of dll interface class may not be declared with dll interface
Compiler error C2488 'identifier': 'naked' can only be applied to non-member function definitions
Compiler error C2489 'identifier': initialized auto or register variable not allowed at function scope in 'naked' function
Compiler error C2490 'keyword' not allowed in function with 'naked' attribute
Compiler error C2491 'identifier': definition of dllimport function not allowed
Compiler error C2492 'variable': data with thread storage duration may not have dll interface
Compiler error C2493 illegal form of __based
Compiler error C2494 'keyword' cannot be called from within a filter expression or __finally/finally block
Compiler error C2495 'identifier': '__declspec(noexcept)' can only be applied to function declarations or definitions
Compiler error C2496 'identifier': 'selectany' can only be applied to data items with external linkage
Compiler error C2497 'identifier': 'implementation_key' can only be applied to function declarations
Compiler error C2498 'function': 'novtable' can only be applied to class declarations or definitions
Compiler error C2499 'class': a class cannot be its own base class

See also

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