Error C2065: An undeclared identifier is wrong

Source: Internet
Author: User

Original address: http://blog.sina.com.cn/s/blog_8216ada701017evx.html

In VS2010 under VC + + debugging, there is a mistake: Error C2065: Undeclared identifier, then feel very strange, why say weird? Because it is normal to have such an error if the associated. h file is not introduced in the. CPP, but now that the relevant header file has been introduced, there are still errors such as Error C2065, error C2087, error C2133 ... The error.

In this case, a new project was created that wanted to use the same set of. cpp/.h files as defined in other projects, but the code in the full copy file was prompted in the new project, but there was no error in the original project, and the same machine was in error. At that time, the idea is that the properties of the two projects are different, so that the properties of the new project to change the original project properties, but there are still such errors, in the online search for this information, most of the introduction is not the introduction of the relevant header file, after all, the error is: undeclared identifier, But that changed to not solve the problem.

The final solution is to modify the order of the header files, the original copy "#include" StdAfx.h "" in the last position of several header files, advance it to the front position, the problem is resolved. The original is not only to introduce the relevant header file, its position should be put correctly . Of course, the precompiled header file should be placed in the first place, but in the original project in the last but no mistakes, strange.

Error C2065: An undeclared identifier is wrong

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.