Compiler errors C2300 Through C2399
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 C2300 | 'class': class does not have a destructor called '~class' |
Compiler error C2301 | left of '->~identifier' must point to class/struct/union |
Compiler error C2302 | left of '.~identifier' must have class/struct/union type |
Compiler error C2303 | Structured exception handling cannot be used in a coroutine |
Compiler error C2304 | 'keyword' cannot be used inside of a catch block |
Compiler error C2305 | 'file' does not contain debugging information for this module |
Compiler error C2306 | 'file' does not contain the most recent debugging information for this module |
Compiler error C2307 | pragma directive must be moved outside of the function if incremental compilation is enabled |
Compiler error C2308 | concatenating mismatched strings |
Compiler error C2309 | catch handler expected a parenthesized exception declaration |
Compiler error C2310 | catch handlers must specify one type |
Compiler error C2311 | 'type': is caught by '...' on line number |
Compiler error C2312 | 'type1': is caught by 'type2' on line number |
Compiler error C2313 | 'type1': is caught by reference ('type2') on line number |
Compiler error C2314 | keyword 'keyword1' is deprecated: use 'keyword2' instead |
Compiler error C2315 | 'type1': reference is caught by 'type2' on line number |
Compiler error C2316 | 'type': cannot be caught as the destructor and/or copy constructor are inaccessible or deleted |
Compiler error C2317 | 'try' block starting on line 'number' has no catch handlers |
Compiler error C2318 | no try block associated with this catch handler |
Compiler error C2319 | 'try/catch' must be followed by a compound statement. Missing '{' |
Compiler error C2320 | expected ':' to follow access specifier 'specifier' |
Compiler error C2321 | 'identifier' is a keyword, and cannot be used in this context |
Compiler error C2322 | 'identifier': address of dllimport 'identifier' is not static |
Compiler error C2323 | 'identifier': non-member operator new or delete functions may not be declared static or in a namespace other than the global namespace |
Compiler error C2324 | 'identifier': unexpected to the right of '::~' |
Compiler error C2325 | 'type1': unexpected type to the right of '->~': expected 'type2' |
Compiler error C2326 | 'declarator': function cannot access 'identifier' |
Compiler error C2327 | 'identifier': is not a type name, static, or enumerator |
Compiler error C2328 | 'keyword': keyword is not yet supported |
Compiler error C2329 | 'identifier': __ptr64 not available for pointers to functions |
Compiler error C2330 | 'implementation_key( )' is only valid in a region bounded by #pragma start_map_region/stop_map_region |
Compiler error C2331 | access to 'identifier' now defined to be 'accessibility1', previously it was defined to be 'accessibility2' |
Compiler error C2332 | 'typedef': missing tag name |
Compiler error C2333 | 'function': error in function declaration; skipping function body |
Compiler error C2334 | unexpected token(s) preceding 'token'; skipping apparent function body |
Compiler error C2335 | 'identifier': a type cannot be introduced in a function parameter list |
Compiler error C2336 | 'type': illegal type |
Compiler error C2337 | 'attribute': attribute not found |
Compiler error C2338 | (error message from external provider) |
Compiler error C2339 | 'identifier': illegal type in embedded-IDL |
Compiler error C2340 | 'identifier': 'static' can only be used within a class definition |
Compiler error C2341 | 'section': segment must be defined using #pragma data_seg, code_seg or section prior to use |
Compiler error C2342 | syntax error: conflicting type qualifiers |
Compiler error C2343 | 'section': conflicting section attributes |
Compiler error C2344 | align(number): alignment must be power of two |
Compiler error C2345 | align(number): illegal alignment value |
Compiler error C2346 | 'function' cannot be compiled as native: 'explanation' |
Compiler error C2347 | Obsolete. |
Compiler error C2348 | 'type': is not a C-style aggregate, cannot be exported in embedded-IDL |
Compiler error C2349 | 'function' cannot be compiled as managed: 'explanation'; use #pragma unmanaged |
Compiler error C2350 | 'identifier' is not a static member |
Compiler error C2351 | obsolete C++ constructor initialization syntax |
Compiler error C2352 | 'identifier': illegal call of non-static member function |
Compiler error C2353 | exception specification is not allowed |
Compiler error C2354 | Obsolete. |
Compiler error C2355 | 'this': can only be referenced inside non-static member functions or non-static data member initializers |
Compiler error C2356 | initialization segment must not change during translation unit |
Compiler error C2357 | 'identifier': must be a function of type 'type' |
Compiler error C2358 | 'identifier': a static property cannot be defined outside of a class definition |
Compiler error C2359 | Obsolete. |
Compiler error C2360 | initialization of 'identifier' is skipped by 'case' label |
Compiler error C2361 | initialization of 'identifier' is skipped by 'default' label |
Compiler error C2362 | initialization of 'identifier' is skipped by 'goto label' |
Compiler error C2363 | compiler intrinsic numeric limit function requires a string literal argument |
Compiler error C2364 | 'type': illegal type for custom attribute |
Compiler error C2365 | 'member1': redefinition; previous definition was 'member2' |
Compiler error C2366 | 'identifier': redefinition; different implementation_key specifiers |
Compiler error C2367 | Obsolete. |
Compiler error C2368 | 'identifier': redefinition; different allocation specifiers |
Compiler error C2369 | 'identifier': redefinition; different subscripts |
Compiler error C2370 | 'identifier': redefinition; different storage class |
Compiler error C2371 | 'identifier': redefinition; different basic types |
Compiler error C2372 | 'identifier': redefinition; different types of indirection |
Compiler error C2373 | 'identifier': redefinition; different type modifiers |
Compiler error C2374 | 'identifier': redefinition; multiple initialization |
Compiler error C2375 | 'identifier': redefinition; different linkage |
Compiler error C2376 | 'identifier': redefinition; different based allocation |
Compiler error C2377 | 'identifier': redefinition; typedef cannot be overloaded with any other symbol |
Compiler error C2378 | 'identifier': redefinition; symbol cannot be overloaded with a typedef |
Compiler error C2379 | formal parameter number has different type when promoted |
Compiler error C2380 | type(s) preceding 'identifier' (constructor with return type, or illegal redefinition of current class-name?) |
Compiler error C2381 | 'identifier': redefinition; '__declspec(noreturn)' or '[[noreturn]]' differs |
Compiler error C2382 | 'identifier': redefinition; different exception specifications |
Compiler error C2383 | 'identifier': default-arguments are not allowed on this symbol |
Compiler error C2384 | 'member': cannot apply thread_local or __declspec(thread) to a member of a managed/WinRT class |
Compiler error C2385 | ambiguous access of 'member' |
Compiler error C2386 | 'identifier': a symbol with this name already exists in the current scope |
Compiler error C2387 | 'identifier': ambiguous base class |
Compiler error C2388 | 'identifier': a symbol cannot be declared with both __declspec(appdomain) and __declspec(process) |
Compiler error C2389 | 'operator': illegal operand 'nullptr' |
Compiler error C2390 | 'identifier': incorrect storage class 'specifier' |
Compiler error C2391 | 'identifier': 'friend' cannot be used during type definition |
Compiler error C2392 | 'member1': covariant returns types are not supported in managed/WinRT types, otherwise 'member2' would be overridden |
Compiler error C2393 | 'symbol': per-appdomain symbol cannot be allocated in segment 'segment' |
Compiler error C2394 | 'type::operator operator': CLR/WinRT operator not valid. At least one parameter must be of the following types: 'T^', 'T^%', 'T^&', where T = 'type' |
Compiler error C2395 | 'type::operator operator': CLR/WinRT operator not valid. At least one parameter must be of the following types: 'T', 'T%', 'T&', 'T^', 'T^%', 'T^&', where T = 'type' |
Compiler error C2396 | 'type1::operator type2': CLR/WinRT user-defined conversion function not valid. Must either convert from or convert to: 'T^', 'T^%', 'T^&', where T = 'type1' |
Compiler error C2397 | conversion from 'type1' to 'type2' requires a narrowing conversion |
Compiler error C2398 | Element 'number': conversion from 'type1' to 'type2' requires a narrowing conversion |
Compiler error C2399 | Obsolete. |
See also
C/C++ Compiler and build tools errors and warnings
Compiler errors C2001 - C3999, C7000 - C7999