這是我目前頭採集:類定義和包括串
#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