What is an ‘undeclared identifier’ error and how do I fix it?

What are undeclared identifier errors? What are common causes and how do I fix them?

Example error texts:

  • For the Visual Studio compiler: error C2065: 'cout' : undeclared identifier
  • For the GCC compiler: 'cout' undeclared (first use in this function)

Leave a Comment