比如已有: testView.h testDoc.h resource.h mynewfile.cpp
如果要在mynewfile.cpp中添加testView.h, 有时会提示 undeclared identifier 等错误.
所以需要在mynewfile.cpp添加testView.h之前,添加testDoc.h resource.h. 这样就不会有问题了.
本文介绍了解决在 C++ 编程中因头文件引入顺序不当而导致的编译错误的方法。通过一个具体的例子说明了如何正确地引入头文件以避免 undeclared identifier 等错误。

被折叠的 条评论
为什么被折叠?