mot*_*oto 1 c++ compilation class
我有一个非常简单的类,在simulator.h中称为模拟器
#include <iostream.h>
#include <stdlib.h>
Class Simulator {
private:
short int startFloor;
short int destFloor;
public:
void setFloors();
void getFloors(short int &, short int &);
};
Run Code Online (Sandbox Code Playgroud)
现在当我编译它时,我得到这个错误:
simulator.h:4:错误:`Class'没有命名类型
这里有什么问题?
您需要使用Class小写(并且应该停止使用已弃用的iostream.h标头):
#include <iostream>
#include <cstdlib>
class Simulator {
// Stuff here
}
Run Code Online (Sandbox Code Playgroud)