c++ 为什么我会收到"does not name a type"错误?
c++ Why do I get "does not name a type" error?
在我的主类中,我有:
#include "main.h"
outPut O;
int main(){
...
}
其中main.h文件包含#include "outPut.h"
"outPut.h"行有:
#ifndef OUTPUT_H
#define OUTPUT_H
#include <iostream>
#include <fstream>
#include "properties.h"
#include "particles.h"
class outPut{
public:
outPut();
std::ofstream file;
void show(lipid * l);
};
#endif
和outPut.cpp:
#include "outPut.h"
outPut::outPut(){
}
当我编译这个时,我得到了错误:
main.cpp:3: error: ' outPut '不存在命名一个类型
为什么?
谢谢…编辑,找到了。main.h未保存,#include "outPut.h"被取消
您需要在main.cpp
中添加#include "outPut.h"
为所有源文件中的OUTPUT_H设置grep。您可能无意中在outPut.h之前包含的其他标头中定义了include保护。
相关文章:
- 将系数存储在头文件的数组中("does not name a type"错误)
- 将成员函数作为构造函数参数调用时出错 "Variable is not a type name"
- 如何解决"'mutex' in namespace 'std' does not name a type"?
- 在 C++ 中使用命名空间时出现"does not name a type"错误
- 已声明时"Does not name a type"错误
- 嵌套类"does not name a type"
- 为什么当我的代码超出函数范围时,"does not name a type"出现编译器错误?
- 无法分隔标头类。我得到"does not name a type"
- 修复第三方代码:"error: ‘enable_if’ in namespace ‘std’ does not name a template type"
- 在 c++ 中,如果包含标头,为什么我会收到'does not a name of type'错误?
- 什么原因导致我的"‘FatalError’ in namespace ‘Foam’ does not name a type"错误?
- 编译错误"String does not name a type"
- 在模板化类中使用嵌套嵌套类时的'dependent name is not a type'
- 如何修复" 'Function' does not name a type "?[阿杜伊诺]
- 类定义内部"error: 'a' does not name a type"
- "does not name a type" .但它确实如此
- C++:声明'TYPE& name(&TYPE);'是什么意思?
- 是否存在使用name=type;的私有项;
- 返回"does not name type"的模板化类
- 在命名空间内实例化时的 C++ "Does not name type"