Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.

Tip of the Day
Language: C++
Expertise: Beginner
Aug 15, 2009



Building the Right Environment to Support AI, Machine Learning and Deep Learning

Decoding General Compiler Error Messages

Error: Undeclared Identifier

Example error message:

doy.cpp: In function 'int main()': doy.cpp:25: 'DayOfYear' undeclared 
  (first use this function) doy.cpp:25: (Each undeclared identifier is reported only 
   once for each function it appears in.) doy.cpp:25: parse error before ';' token


You used DayOfYear in your code, but the compiler has not seen a definition for DayOfYear. It doesn't know what DayOfYear is.

Usual Causes

  1. You forgot to include the header file that defines the class/struct/function/etc.
  2. You misspelled the name of the identifier.

Error: cout Undeclared

Example error message:

xyz.cpp: In function 'int main()': xyz.cpp:6: 'cout' undeclared (first use 
  this function) xyz.cpp:6: (Each undeclared identifier is reported only once for each 
  function it appears in.)


This is really a special case of the "Undeclared Identifier" error.

Usual Causes

  1. You forgot to include <ostream>.
  2. You forgot using namespace std;.
Kumar Arvind
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date