这是我目前头采集:类定义和包括串
#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位都在我的主文件和我的“功能definitions.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
你有'#include string'或'#include'? –
2012-04-18 14:48:55
您的床类缺少一个尾随的分号'class Bed:public Item {// details ...}; // <-add分号“ – EdChum 2012-04-18 14:49:32