これは私の現在のヘッダーのコレクションです:
#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()
インクルードと名前空間の標準ビットは、メイン ファイルと「関数定義.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
文字列を含める必要がありますか?これが問題を引き起こす可能性があることをどこかで読んだので、それが解決策でない場合はどうすればよいですか?
Ta かなり Hx