这是我目前收集的标题:
#include "Header1.h"
#include "BedAndMatress.h"
#include "Sofa.h"
#include "Table.h"
#include iostream
#include fstream
#include iomanip
#include string
#include cmath
#include vector
using namespace std;
int main()
包含和命名空间 std 位在我的主文件和我的“函数定义.cpp”文件中。但是,编译器会抛出一些错误:
e:\computing\coursework2\programme.cpp(2) : fatal error C1083: Cannot open include
file: 'BedAndMatress.h': No such file or directory
最初我在 Header1.h 文件中定义了我的所有类,但它抱怨文件和类定义的意外结束,所以我决定将它们分开。该文件包含在项目中,所有其他文件似乎都在工作,所以我不确定发生了什么。我还创建了一个名为 Bed 的新头文件,但它有相同的错误,所以我更改了它,认为可能已经有一个具有该名称的标准文件(显然是长镜头)是否有最大数量的头文件?
此外,在类定义中,一些成员对象是字符串......
#ifndef CLASS_Bed
#define CLASS_Bed
//////BED
class Bed:public Item
{
string frame;
string frameColour;
string mattress;
public:
int Bed(int count);
int Bed(int count, int number, string name, string frm, string fclr, string mtres);
void count();
void printDetails();
}
#endif
但它不识别类型说明符。
error C2501: 'string' : missing storage-class or type specifiers
我应该包括字符串吗?我在某处读到这可能会导致问题,所以如果那不是解决方案,我应该如何进行?
太极Hx