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

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