何が起こっているのかまったくわかりません。ここで起こっている奇妙なことの説明を探していましたが、私の状況はある意味で独特のようです. 各ファイルにヘッダー ファイルをインクルードする順序だと想像しましたが、役に立たなかったので、解決策と思われる組み合わせが見つかりませんでした。
私が得ているように見える正確なエラーは、宣言時に「ログに型の名前がありません」LogArray[maxLength]
です。
私のクラスの 1 つ、クラス logmgmt:
class logmgmt
{
private:
static const int maxLength = 500;
log LogArray[maxLength];
int length;
public:
void fillLogs(int index, int iD, std::string date, double startTime, double endTime);
void displayThisLog(int index);
void setLength(int length);
};
logmgmt.cpp 内のプリプロセッサ ディレクティブ:
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#include "log.h"
#include "Logmgmt.h"
そして main.cpp 内のディレクティブ
#include <iostream>
#include <fstream>
#include <cstdlib>
using namespace std;
#include "employee.h"
#include "log.h"
#include "employeemgmt.h"
#include "Logmgmt.h"