Редагувати

Поділитися через


Microsoft C/C++ compiler warnings C4000 through C4199

The articles in this section describe Microsoft C/C++ compiler warning messages C4000 through C4199.

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.

Warning messages

Warning Message
Compiler warning (level 4, no longer emitted) C4001 nonstandard extension 'single line comment' was used
Compiler warning (level 1, Error) C4002 too many arguments for function-like macro invocation 'identifier'
Compiler warning (level 1, Error) C4003 not enough arguments for function-like macro invocation 'identifier'
Compiler warning (level 1) C4005 'identifier': macro redefinition
Compiler warning (level 1) C4006 #undef expected an identifier
Compiler warning (level 3) C4007 'function': must be 'attribute'
Compiler warning (level 3) C4008 'function': 'attribute' attribute ignored
Compiler warning (level 1) C4010 single-line comment contains line-continuation character
Compiler warning (level 3) C4013 'function' undefined; assuming extern returning int
Compiler warning (level 1) C4015 'identifier': type of bit field must be integral
Compiler warning (level 3) C4018 'expression': signed/unsigned mismatch
Compiler warning (level 4) C4019 empty statement at global scope
Compiler warning (level 1) C4020 'function': too many actual parameters
Compiler warning (level 1) C4022 'function': pointer mismatch for actual parameter 'parameter_number'
Compiler warning (level 1) C4023 'function': based pointer passed to unprototyped function: parameter 'parameter_number'
Compiler warning (level 1) C4024 'function': different types for formal and actual parameter 'parameter_number'
Compiler warning (level 1) C4025 'function': based pointer passed to function with variable arguments: parameter 'parameter_number'
Compiler warning (level 1) C4026 function declared with formal parameter list
Compiler warning (level 1) C4027 function declared without formal parameter list
Compiler warning (level 1) C4028 formal parameter parameter_number different from declaration
Compiler warning (level 1) C4029 declared formal parameter list different from definition
Compiler warning (level 1) C4030 first formal parameter list longer than the second list
Compiler warning (level 1) C4031 second formal parameter list longer than the first list
Compiler warning (level 4) C4032 formal parameter parameter_number has different type when promoted
Compiler warning (level 1) C4033 'function' must return a value
Compiler warning (level 1) C4034 sizeof returns 0
Compiler warning (level 3) C4035 'function': no return value
Compiler warning (level 1) C4036 unnamed 'type' as actual parameter
Compiler warning (level 1) C4038 'modifier': illegal class modifier
Compiler warning (level 1) C4041 compiler limit: terminating browser output
Compiler warning (level 1) C4042 'identifier': has bad storage class
Compiler warning (level 1) C4045 'array': array bounds overflow
Compiler warning (level 1) C4047 'operator': 'identifier1' differs in levels of indirection from 'identifier2'
Compiler warning (level 1) C4048 different array subscripts: 'identifier1' and 'identifier2'
Compiler warning (level 1) C4049 compiler limit: terminating line number emission
Compiler warning (level 1) C4051 type conversion; possible loss of data
Compiler warning (level 1 and level 4) C4052 function declarations different; one contains variable arguments
Compiler warning (level 4) C4053 one void operand for '?:'
Compiler warning (level 1) C4055 'conversion' : from data pointer 'type1' to function pointer 'type2'
Compiler warning (level 2) C4056 overflow in floating-point constant arithmetic
Compiler warning (level 4) C4057 'operator': 'identifier1' differs in indirection to slightly different base types from 'identifier2'
Compiler warning (level 3, off) C4060 switch statement contains no 'case' or 'default' labels
Compiler warning (level 4, off) C4061 enumerator 'identifier' in switch of enum 'enumeration' is not explicitly handled by a case label
Compiler warning (level 4, off) C4062 enumerator 'identifier' in switch of enum 'enumeration' is not handled
Compiler warning (level 4) C4063 case 'identifier' is not a valid value for switch of enum 'enumeration'
Compiler warning (level 4) C4064 switch of incomplete enum 'enumeration'
Compiler warning (level 3, off) C4065 switch statement contains 'default' but no 'case' labels
Compiler warning (level 3) C4066 characters beyond first in wide-character constant ignored
Compiler warning (level 1) C4067 unexpected tokens following preprocessor directive - expected a newline
Compiler warning (level 1) C4068 unknown pragma 'identifier'
Compiler warning C4069 long double is the same precision as double
Compiler warning (level 3) C4073 initializers put in library initialization area
Compiler warning (level 1) C4074 initializers put in compiler reserved initialization area
Compiler warning (level 1) C4075 initializers put in unrecognized initialization area
Compiler warning (level 1) C4076 'type_modifier': can't be used with type 'typename'
Compiler warning (level 1) C4077 unknown check_stack option
Compiler warning (level 1) C4079 unexpected token 'token'
Compiler warning (level 1) C4080 expected identifier for segment name; found 'symbol'
Compiler warning (level 1) C4081 expected 'token1'; found 'token2'
Compiler warning (level 1) C4083 expected 'token'; found identifier 'identifier'
Compiler warning (level 1) C4085 expected pragma parameter to be 'on' or 'off'
Compiler warning (level 1) C4086 expected pragma parameter to be '1', '2', '4', '8', or '16'
Compiler warning (level 1) C4087 'function': declared with 'void' parameter list
Compiler warning (level 1) C4088 'function': pointer mismatch in actual parameter 'parameter_number', formal parameter 'parameter_number'
Compiler warning (level 1) C4089 'function': different types in actual parameter 'parameter_number', formal parameter 'parameter_number'
Compiler warning (level 1) C4090 'operation': different 'modifier' qualifiers
Compiler warning (level 1 and level 2) C4091 'keyword': ignored on left of 'type' when no variable is declared
Compiler warning (level 4) C4092 sizeof returns 'unsigned long'
Compiler warning (level 2) C4094 untagged 'token' declared no symbols
Compiler warning (level 1) C4096 'identifier': interface is not a COM interface; will not be emitted to IDL
Compiler warning (level 1) C4097 expected pragma parameter to be 'restore' or 'off'
Compiler warning (level 1) C4098 'function': 'void' function returning a value
Compiler warning (level 2) C4099 'identifier': type name first seen using 'object_type1' now seen using 'object_type2'
Compiler warning (level 4) C4100 'identifier': unreferenced formal parameter
Compiler warning (level 3 and level 4) C4101 'identifier': unreferenced local variable
Compiler warning (level 3) C4102 'label': unreferenced label
Compiler warning (level 1) C4103 alignment changed after including header, may be due to missing #pragma pack(pop)
Compiler warning (level 1) C4109 unexpected identifier 'identifier'
Compiler warning (level 1 and level 4) C4112 #line requires an integer between 1 and 'line_count'
Compiler warning (level 1) C4113 'identifier1' differs in parameter lists from 'identifier2'
Compiler warning (level 1) C4114 same type qualifier used more than once
Compiler warning (level 1 and level 4) C4115 'type': named type definition in parentheses
Compiler warning (level 1) C4116 unnamed type definition in parentheses
Compiler warning (level 1) C4117 macro name 'name' is reserved, 'command' ignored
Compiler warning (level 1) C4119 different bases 'base1' and 'base2' specified
Compiler warning (level 1) C4120 based/unbased mismatch
Compiler warning (level 4) C4121 'symbol': alignment of a member was sensitive to packing
Compiler warning (level 1) C4122 'function': alloc_text applicable only to functions with C linkage
Compiler warning (level 1) C4123 different base expressions specified
Compiler warning (level 1) C4124 __fastcall with stack checking is inefficient
Compiler warning (level 4) C4125 decimal digit terminates octal escape sequence
Compiler warning (level 4) C4127 conditional expression is constant
Compiler warning (level 1) C4129 'character': unrecognized character escape sequence
Compiler warning (level 4) C4130 'operator': logical operation on address of string constant
Compiler warning (level 4) C4131 'function': uses old-style declarator
Compiler warning (level 4) C4132 'object': const object should be initialized
Compiler warning (level 1 and level 3) C4133 'expression': incompatible types - from 'type1' to 'type2'
Compiler warning C4137 'function': no return value from floating-point function
Compiler warning (level 1) C4138 '*/' found outside of comment
Compiler warning (level 1, Error) C4141 'modifier': used more than once
Compiler warning (level 1) C4142 'identifier': benign redefinition of type
Compiler warning (level 1) C4143 pragma 'same_seg' not supported; use __based allocation
Compiler warning (level 1) C4144 'expression': relational expression as switch expression
Compiler warning (level 1) C4145 'expression1': relational expression as switch expression; possible confusion with 'expression2'
Compiler warning (level 2) C4146 unary minus operator applied to unsigned type, result still unsigned
Compiler warning (level 2) C4150 deletion of pointer to incomplete type 'type'; no destructor called
Compiler warning (level 4) C4152 nonstandard extension, function/data pointer conversion in expression
Compiler warning (level 1) C4153 function/data pointer conversion in expression
Compiler warning (level 1) C4154 deletion of an array expression; conversion to pointer supplied
Compiler warning (level 1) C4155 deletion of an array expression without using the array form of 'delete'
Compiler warning (level 2) C4156 deletion of an array expression without using the array form of 'delete'; array form substituted
Compiler warning (level 1) C4157 pragma was ignored by C compiler
Compiler warning (level 1) C4158 assuming #pragma pointers_to_members(full_generality, 'inheritance_type')
Compiler warning (level 3) C4159 #pragma 'pragma'(pop,...): has popped previously pushed identifier 'identifier'
Compiler warning (level 1) C4160 #pragma 'pragma'(pop,...): did not find previously pushed identifier 'identifier'
Compiler warning (level 3) C4161 #pragma 'pragma'(pop...): more pops than pushes
Compiler warning (level 1) C4162 'identifier': no function with C linkage found
Compiler warning (level 1) C4163 'identifier': not available as an intrinsic function
Compiler warning (level 1) C4164 'function': intrinsic function not declared
Compiler warning (level 3, off) C4165 'HRESULT' is being converted to 'bool'; are you sure this is what you want?
Compiler warning (level 1) C4166 illegal calling convention for constructor/destructor
Compiler warning (level 1) C4167 'function': only available as an intrinsic function
Compiler warning (level 1) C4168 compiler limit: out of debugger types, delete program database 'database' and rebuild
Compiler warning (level 1) C4172 returning address of local variable or temporary optional_context
Compiler warning (level 1) C4174 'name': not available as a #pragma component
Compiler warning (level 1) C4175 #pragma component(browser, on): browser info must initially be specified on the command line
Compiler warning (level 1) C4176 'subcomponent': unknown subcomponent for #pragma component browser
Compiler warning (level 1) C4177 #pragma 'pragma' should only be used at global scope or namespace scope
Compiler warning (level 1) C4178 case constant 'constant' too big for the type of the switch expression
Compiler warning (level 4, no longer emitted) C4179 '//*': parsed as '/' and '/\*': confusion with standard '//' comments
Compiler warning (level 1) C4180 qualifier applied to function type has no meaning; ignored
Compiler warning C4181 qualifier applied to reference type; ignored
Compiler warning (level 1) C4182 #include nesting level is nest_count deep; possible infinite recursion
Compiler warning (level 1) C4183 'identifier': missing return type; assumed to be a member function returning 'int'
Compiler warning (level 1) C4185 ignoring unknown #import attribute 'attribute'
Compiler warning (level 1) C4186 #import attribute 'attribute' requires 'argument_count' arguments; ignored
Compiler warning (level 1) C4187 #import attributes 'attribute1' and 'attribute2' are incompatible; both ignored
Compiler warning (level 1) C4188 constant expression is not integral
Compiler warning (level 3 and level 4) C4189 'identifier': local variable is initialized but not referenced
Compiler warning (level 1) C4190 'identifier1' has C-linkage specified, but returns UDT 'identifier2' which is incompatible with C
Compiler warning (level 3, off) C4191 'operation': unsafe conversion from 'type_of_expression' to 'type_required'
Making a function call using the resulting pointer may cause your program to fail
Compiler warning (level 3) C4192 automatically excluding 'identifier' while importing type library 'library'
Compiler warning (level 3) C4193 #pragma warning(pop): no matching '#pragma warning(push)'
Compiler warning (level 1) C4194 #pragma start_map_region cannot be nested; ignored
Compiler warning (level 1) C4195 #pragma stop_map_region used without matching #pragma start_map_region; ignored
Compiler warning (level 1) C4196 expected 'token1' or 'token2'; found 'token3'
Compiler warning (level 3) C4197 'type': top-level volatile in cast is ignored
Compiler warning (level 1, level 2, level 3, and level 4) C4199 message

See also

C/C++ Compiler and build tools errors and warnings
Compiler warnings C4000 - C5999