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) 回答1: They most often come from forgetting to include the header file that contains the function declaration, for example, this program will give an 'undeclared identifier' error: Missing header int main() { std::cout << "Hello world!" << std: