ヘッダーファイルで以下のように構造といくつかの関数を定義しました
struct ScDetPos
{
bool status[MAXD];
int noofdetectors;
float x[MAXD];
float y[MAXD];
float z[MAXD];
};
// read sc position
// this function reads sc det coordinate file and returns the structure
ScDetPos ReadScCoordinates();
// print the sccordinates
void DisplayScCoordinates(ScDetPos sc);
ソース ファイルには、上記の 2 つの関数の関数定義があります。
{
ScDetPos scpos;
scpos = ReadScCoordinates();
DisplayScCoordinates(scpos);
}
問題なくコンパイルできていますが、
以下のように、構造体「ScDetPos」のデータを計算と比較に使用すると、エラーが発生します。
neutron-time.cpp:240: error: ‘scpos’ was not declared in this scope
neutron-time.cpp:280: error: ‘scpos’ was not declared in this scope