C + + Common errors in Chinese and English control table _c language

Source: Internet
Author: User
Tags array length function definition

Fatal error C1003:error count exceeds number; Stopping compilation
(compilation error) Too many errors, stop compiling
Analysis: Modify the previous error, compile again

Fatal error c1004:unexpected end of file found
(compilation error) file not finished
Analysis: A function or a struct definition is missing "}", or there is no pairing of parentheses in a function call or expression, or the annotation character "/*...*/" is incomplete, etc.

Fatal error C1083:cannot open include file: ' xxx ': No such file or directory
(compilation error) Unable to open header file XXX: No this file or path
Parsing: Header file does not exist, or the header file is misspelled, or the file is read-only

Fatal error c1903:unable to recover from previous error (s); Stopping compilation
(compilation error) cannot recover from previous errors, stop compiling
Analysis: There are many reasons for the error, it is recommended to first modify the previous error

Error C2001:newline in constant
In Chinese: (Compile error) Create a new row in a constant
Parsing: String Constants writing multiple lines

Error C2006: #include expected a filename, found ' identifier '
In Chinese: (compilation error) #include命令中需要文件名
Analysis: Typically the header file is not enclosed in a pair of double quotes or angle brackets, such as "#include stdio.h"

Error C2007: #define Syntax
In Chinese: (compilation error) #define语法错误
Analysis: Missing macro names, such as "#define" after "#define"

Error C2008: ' xxx ': unexpected in macro definition
In Chinese: (compilation error) An unexpected XXX occurred while the macro was defined
Analysis: There should be spaces between the macro name and the replacement string when a macro is defined, such as "#define TRUE" 1 ""

Error c2009:reuse of macro formal ' identifier '
In Chinese: (compilation error) repeated use of formal parameters with parameter macros
Analysis: Macro Definition If parameter cannot have duplicate name, for example "#define S (a,a) (a*a)", parameter a repeats

Error C2010: ' character ': unexpected in macro formal parameter list
In Chinese: (compilation error) An unknown character appears in a parameter table with a parameter macro
Analysis: For example, "#define S (r|) r*r" The parameter is one more character ' | '

Error C2014:preprocessor command must start as a nonwhite space
(compilation error) Pre-processing command allows only spaces
Analysis: Each preprocessing command should be exclusive one line and no other non-whitespace characters should appear

Error C2015:too many characters in constant
In Chinese: (compilation error) A constant contains more than one character
Parsing: Character constants can have only one character in single quotes, or an escape character that starts with "\", such as "char error = ' ERROR ';"

Error C2017:illegal escape sequence
(compilation error) escape character illegal
Analysis: Typically the escape character is located outside of ' or ', such as ' char error = ' \ n;

Error C2018:unknown character ' 0xhh '
(compilation error) unknown character 0xhh
Analysis: The Chinese punctuation is generally entered, for example, "char error = ' E ';"

Error c2019:expected preprocessor directive, found ' character '
(compilation error) expecting preprocessing command, but invalid characters
Analysis: It is generally the # Number of preprocessing commands and mistakenly enter other invalid characters, such as "#!define TRUE 1"

Error c2021:expected exponent value, not ' character '
(compilation error) expecting exponential value, cannot be a character
Analysis: Generally, the exponential representation of floating-point numbers is incorrect, such as 123.456E

Error C2039: ' identifier1 ': ' Not ' a ' identifier2 '
(compilation error) identifier 1 is not a member of identifier 2
Analysis: The program incorrectly calls or references the struct body, the shared body, the members of the class

Error c2041:illegal digit ' x ' for base ' n '
(compilation error) the number x is illegal for n-ary
Analysis: typically octal or hexadecimal numbers indicate an error, such as "int i = 081;" The number ' 8 ' in the statement is not the cardinality of the octal

Error c2048:more than one default
(compilation error) The default statement is more than one
Analysis: There can be only one default in the switch statement, delete the extra default

Error C2050:switch expression not integral
(compilation error) The switch expression is not an integral type
Analysis: The switch expression must be an integral type (or character type), for example, "switch (" a ") is a string in the expression, which is illegal

Error C2051:case expression not constant
(compilation error) Case expression is not a constant
Analysis: Case expressions should be constant expressions, such as "case" a "" "" A "is a string, this is illegal

Error C2052: ' type ': illegal type for CASE expression
(compilation error) Case expression type illegal
Analysis: Case expression must be an integer constant (including character type)

Error c2057:expected constant expression
In Chinese: (compilation error) expecting constant expression
Analysis: Generally defines an array when the length of the array is variable, for example, "int n=10;" int a[n]; " Medium n is a variable, this is illegal

Error c2058:constant expression is not integral
(compilation error) The constant expression is not an integer
Analysis: Typically, array lengths are not integer constants when defining arrays

Error c2059:syntax error: ' xxx '
(compilation error) ' XXX ' syntax error
Analysis: Causes the error many reasons, may add the symbol xxx more or less

Error c2064:term does not evaluate to a function
C: (compilation error) The function language is not recognized
Analysis: 1, the function parameter is incorrect, the expression may be incorrect, for example "sqrt (s-a) (s-b) (s-c);" Incorrect expression in
2, variable and the duplicate of the function or the identifier is not a function, for example, "int i,j;" J=i (); " Middle I is not a function

Error C2065: ' xxx ': undeclared identifier
(compilation error) undefined identifier XXX
Analysis: 1, if XXX is cout, cin, scanf, printf, sqrt, etc., the program contains the wrong header file
2, undefined variables, arrays, function prototypes, and so on, pay attention to spelling errors or case-sensitive.

Error C2078:too Many initializers
In Chinese: (compilation error) too many initial values
Analysis: Typically, the number of initial values is larger than the array length, for example, "int b[2]={1,2,3};"

Error c2082:redefinition of formal parameter ' xxx '
In Chinese: (compilation error) duplicate define form parameter xxx
Analysis: Formal parameters in the first part of a function cannot be defined again in the body

Error c2084:function ' xxx ' already has a body
In Chinese: (compilation error) defined function xxx
Analysis: In VC + + earlier version of the function can not be the same name, 6.0 version of the support function overload, function names can be the same but the parameters are different

Error C2086: ' xxx ': redefinition
(compile error) identifier XXX redefine
Analysis: variable name, array name duplicate

Error C2087: ' <Unknown> ': missing subscript
In Chinese: (compilation error) subscript unknown
Analysis: Typically defines a two-dimensional array without specifying the length of the second dimension, such as "int a[3][];"

Error C2100:illegal indirection
(compilation error) Illegal indirect access operator "*"
Analysis: Using the "*" operation on non-pointer variables

Error C2105: ' operator ' needs l-value
(compile error) operator requires left value
Analysis: For example "(a+b) + +;" Statement, the "+ +" operator is not valid

Error C2106: ' operator ': left operand must to be l-value
(compilation error) the left operand of the operator must be a left value
Analysis: for example "a+b=1;" Statement, the left value of the ' = ' operator must be a variable, not an expression

Error C2110:cannot Add two pointers
In Chinese: (compilation error) Two pointer amount cannot be added
Analysis: for example "int *pa,*pb,*a;" A = pa + pb; " Two pointer variables in can not be "+" operations

Error C2117: ' xxx ': array bounds overflow
In Chinese: (compilation error) array xxx boundary overflow
Analysis: Typically the character array is initialized with a string length greater than the length of the character array, such as "char str[4] =" ABCD ";"

Error c2118:negative subscript or subscript is too large
(compilation error) subscript negative or subscript too large
Parsing: Typically defining an array or referencing an array element is not properly labeled

Error c2124:divide or mod by zero
(compilation error) by 0 or on 0
Analysis: For example "int i = 1/0;" Divisor is 0

Error C2133: ' xxx ': unknown size
(compilation error) unknown length of array xxx
Analysis: It is generally not initialized or specified array length when defining an array, for example, "int a[];"

Error C2137:empty character constant.
(compilation error) character literal constant is null
Analysis: A pair of single quotes "'" can not have any characters

Error C2143:syntax error:missing ' token1 ' before ' token2 '
Error C2146:syntax error:missing ' token1 ' before identifier ' identifier '
(compilation error) write language symbol 1 before identifier or language symbol 2
Analysis: Language symbols such as "{", ")" or ";" may be missing

Error C2144:syntax error:missing ') ' before type ' xxx '
(Compile error) missing ') ' before XXX type
Analysis: Typically, the type of the argument is defined when the function is called

Error C2181:illegal else without matching if
Illegal (compilation error) There is no else that matches the IF
Analysis: May have added ";" or compound statements are not using "{}"

Error C2196:case value ' 0 ' already used
(compilation error) case value 0 has been used
Analysis: The value of a constant expression cannot recur after case

Error C2296: '% ': illegal, left operand has type ' float '
Error C2297: '% ': illegal, right operand has type ' float '
(compilation error) the Left (right) operand of the% operation is float, which is illegal
Analysis: The object for the remainder operation must be of type int, the variable type should be defined correctly, or the coercion type conversion should be used

Error C2371: ' xxx ': redefinition; Different basic types
(compilation error) identifier xxx redefine; base type different
Analysis: Define variables, arrays, and so on with duplicate names

Error C2440: ' = ': cannot convert from ' char [2] ' to ' char '
(compilation error) assignment operation, cannot convert from character array to character
Analysis: Cannot assign a value to character data with a string or character array, more generally, the type cannot be converted

Error c2447:missing function header (Old-style formal list?)
Error C2448: ' <Unknown> ': Function-style initializer appears to be a function definition
(compilation error) missing function title (is the old-fashioned form table?) )
Analysis: function definition is incorrect, the first part of the letter "()" after a semicolon or the use of the old-fashioned C-language formal parameter list

Error c2450:switch expression of type ' xxx ' is illegal
(compilation error) The switch expression is an illegal xxx type
Analysis: switch expression type should be int or char

Error C2466:cannot allocate an array of constant size 0
(compilation error) cannot allocate an array of length 0
Analysis: Typically defines an array with an array length of 0

Error C2601: ' xxx ': local function definitions are illegal
(compile error) function XXX defines illegal
Analysis: It is generally defined in the function body of a function another function

Error C2632: ' type1 ' followed by ' type2 ' is illegal
(compilation error) Type 1 immediately after type 2, which is illegal
Analysis: for example "int float i;" Statement

Error C2660: ' xxx ': function does not take n parameters
(compile error) function XXX can not take n parameters
Analysis: The number of arguments is not correct when calling a function, for example, "sin (x,y);"

Error C2664: ' xxx ': cannot convert parameter n from ' type1 ' to ' type2 '
(compile error) function XXX cannot convert the nth argument from type 1 to type 2
Analysis: In general, the actual participation parameter type is inconsistent when the function is called

Error c2676:binary ' << ': ' Class istream_withassign ' does not define this operator or a conversion to a type accept Able to the predefined operator
Error c2676:binary ' >> ': ' Class ostream_withassign ' does not define this operator or a conversion to a type accept Able to the predefined operator
Analysis: ">>", "<<" operators use errors, such as "cin<<x; cout>>y; "

Error C4716: ' xxx ': Must return a value
(compile error) function XXX must return a value
Analysis: The return command with no return value can be used only if the function type is void.

Fatal error Lnk1104:cannot Open file "Debug/cpp1.exe"
(link error) Unable to open file Debug/cpp1.exe
Analysis: recompiling links

Fatal error Lnk1168:cannot open Debug/cpp1.exe for writing
(link error) cannot open Debug/cpp1.exe file to overwrite content.
Analysis: Generally Cpp1.exe is still running, not closed

Fatal error Lnk1169:one or more multiply defined symbols found
In Chinese: (link error) One or more multiple definition symbols appear.
Analysis: General and error LNK2005 appear together

Error lnk2001:unresolved external symbol _main
(link error) unhandled external identification main
Analysis: main spelling errors, such as "Void Mian ()"

Error LNK2005: _main already defined in Cpp1.obj
(link error) The main function is already defined in the Cpp1.obj file
Analysis: The workspace of the previous program was not closed, causing multiple main functions to appear

Warning C4003:not enough actual parameters for macro ' xxx '
(Compile warning) macro XXX does not have enough arguments
Analysis: Typically, parameters are not passed in when the macro expands with a parameter

Warning c4067:unexpected tokens following preprocessor directive-expected a newline
(compile warning) unexpected symbol after preprocessing command-expecting new line
Analysis: "#include <iostream.h>;" ";" After the command is an extra character

Warning C4091: ": Ignored on left of ' type ' when no variable is declared
(Compile warning) Ignore type description when no variable is declared
Parsing: statement "INT;" No variables defined, no effect on program execution

Warning C4101: ' xxx ': unreferenced local variable
(Compile warning) variable XXX defined but not used
Analysis: Can remove the definition of this variable, does not affect program execution

Warning C4244: ' = ': Conversion from ' type1 ' to ' type2 ', possible loss of data
In Chinese: (compilation warning) assignment operation, conversion from data type 1 to data type 2, data may be lost
Analysis: You need to define the variable type correctly, when the data type 1 is float or double, the data type 2 is int, the result may be incorrect, the data type 1 is double, data type 2 is float, and you can ignore the warning

Warning C4305: ' Initializing ': Truncation from ' const double ' to ' float '
In Chinese: (Compile warning) initialize, intercept double constant is float type
Analysis: When assigning values to a float type variable, it generally does not affect the end result

Warning C4390: '; ': empty controlled statement found; Is this the intent?
(Compile warning) '; ' The control statement is an empty statement, is the intent of the program?
Analysis: If statement of the branch or loop control statement of the loop body is an empty statement, generally add ";"

Warning C4508: ' xxx ': function should return a value; ' void ' return type assumed
(Compile warning) function XXX should have a return value, assuming the return type is void
Analysis: General is not defined type of main function is void, does not affect program execution

Warning C4552: ' operator ': operator has no effect; Expected operator with Side-effect
(Compile warning) operator has no effect; operators expecting side effects
Analysis: for example "I+J;" Statement, the "+" operation is meaningless

Warning C4553: ' = = ': operator has no effect; Did you intend ' = '?
(compilation warning) the "= =" operator is invalid;
Analysis: For example, "i==j" statement, "= =" Operation meaningless

Warning c4700:local variable ' xxx ' used without having been initialized
(Compile warning) variable XXX not initialized before use
Analysis: The variable is not assigned, the result may be incorrect, if the variable is assigned through the SCANF function, it is possible to omit the "&" operator, or the variable is assigned through CIN, the statement is incorrect

Warning C4715: ' xxx ': Not all control paths return a value
(Compile warning) function xxx Not all control paths have return values
Analysis: typically include a return statement in the IF statement of the function, and no returned value when the condition of the IF statement is not valid
Warning C4723:potential divide by 0

(compilation warning) may be removed by 0
Analysis: cannot be used as a divisor when the expression value is 0

Warning C4804: ' < ': unsafe using type ' bool ' in Operation
Chinese: (Compile warning) ' < ': Use of unsafe Boolean types
Profiling: For example, relational expressions 0<=x <10 "could cause a logical error

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.