Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/neo4j/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 在c++;如果包含标题,则说明我获得';没有类型为';错误_C++ - Fatal编程技术网

C++ 在c++;如果包含标题,则说明我获得';没有类型为';错误

C++ 在c++;如果包含标题,则说明我获得';没有类型为';错误,c++,C++,我有数据。h: #ifndef DATA_H_INCLUDED #define DATA_H_INCLUDED #include <vector> #include <string> #include <iostream> using namespace std; class student{ public: string id; int points [6] = {0,0,0,0,0,0}; }; #end

我有
数据。h

#ifndef DATA_H_INCLUDED
#define DATA_H_INCLUDED

#include <vector>
#include <string>
#include <iostream>

using namespace std;

class student{
    public:
        string id;
        int points [6] = {0,0,0,0,0,0};
};



#endif // DATA_H_INCLUDED
#ifndef ENOR_H_INCLUDED
#define ENOR_H_INCLUDED
#include <fstream>
#include <vector>
#include <string>
#include <iostream>
#include "data.h"

using namespace std;

enum status{norm,abnorm};

class enor{
    public:
        /*some voids*/
        Student Current() const { return elem; }
        student elem;
    private:
       /*some voids*/
};


#endif // ENOR_H_INCLUDED

我得到了
“学生”不是一个名字,而是一个类型,但为什么呢?如果
学生
计算器在
nor.h
中,我也尝试了,但也出现了此错误。我怎样才能解决这个问题,为什么会这样?

对于你的
学生
班级,你的情况有所不同:

  • class-student
    -小写
    s

  • Student Current()const
    -大写
    S


  • 这是因为你没有在问题中加入a。也有可能是因为.大写/小写的问题。您已经定义了一个名为
    student
    的类,但正在尝试使用
    student
    不好,但在标头中这样做是不可接受的。请从一本好书中学习C++,不管你现在做什么都不能让你在任何地方。请仔细阅读,解释如何使用代码空间STD代码< >code>会导致代码的行为发生不可预测的变化。在这种情况下,仅包含标头可能会导致不相关的代码在编译时中断。