Research Article

On Compiler Error Messages: What They Say and What They Mean

Table 3

Error messages of four different C++ compilers for Errors 1–4.

Compiler Message for Error 1

g++ ANSI C++ forbids declaration ‘ostream’ with no type
‘ostream’ is neither function nor method; cannot be declared friend
parse error before ‘&’

MinGW ISO C++ forbids declaration of ‘ostream’ with no type
‘ostream’ is neither function nor member function; cannot be declared friend
expected ‘;’ before ‘&’ token

MVC++ error C2143: syntax error: missing ‘;’ before ‘&’
error C2433: ‘ostream’: ‘friend’ not permitted on data declarations
error C2501: ‘ostream’: missing storage-class or type specifiers
(plus 4 more lines)

BC++ E2061 Friends must be functions or classes
E2139 Declaration missing;
E2321 Declaration does not specify a tag or an identifier

Compiler Message for Error 2

g++ can’t initialize friend function ‘
friend declaration not in class definition

MinGW can’t initialize friend function ‘operator
friend declaration not in class definition
MVC++ error C2255: ‘ ’: a friend function can only be declared in a class

BC++ E2092 Storage class ‘friend’ is not allowed here

Compiler Message for Error 3

g++ In method ‘float SavingAccount::getInterestRate()’:
parse error before ‘

MinGW In member function ‘float SavingAccount::getInterestRate()’:
expected ‘;’ before ‘ ’ token

MVC++ error C2143: syntax error: missing ‘;’ before ‘

BC++ W8066 Unreachable code
E2379 Statement missing;
(plus 2 more lines)

Compiler Message for Error 4

g++ In method ‘float SavingAccount::getInterestRate()’:
parse error before ‘,’

MinGW In member function ‘float SavingAccount::getInterestRate()’:
expected primary-expression before ‘(’ token
(plus 2 more lines)

MVC++ error C2275: ‘string’: illegal use of this type as an expression
c: program files include xstring(612): see declaration of ‘string’
error C2146: syntax error: missing ‘ ’ before identifier ‘owner_’
error C2059: syntax error: ‘

BC++ W8066 Unreachable code
E2108 Improper use of typedef ‘string’
(plus 4 more lines)