当我去编译我正在处理的这个 Ada 程序时,我完全不明白为什么我会得到一个未定义的错误。我仔细看了一遍……没有拼写错误或任何类似的错误。这是我所拥有的,然后是我得到的错误。
Get_Score(CandidateVotes, CurrentCandidate);
end loop;
end Get_Input;
procedure Get_Score(CandVotes: in CurrentCandidate_Votes;
Candidate: in Character) is
-- get the score for the candidate and store it into CandidatesArray
SameAnswers: Integer;
DifferentAnswers: Integer;
CandidateScore: Integer;
begin
for I in VoterArray_Index loop
if Voter(I) /= 0 And CandVotes(I) /= 0 Then
if Voter(I) /= CandVotes(I) Then
DifferentAnswers := DifferentAnswers + 1;
else
SameAnswers := SameAnswers + 1;
end if;
end if;
end loop;
CandidateScore := SameAnswers - DifferentAnswers;
Candidates(Candidate) := CandidateScore;
end Get_Score;
代码块的顶部是我从另一个过程调用 Get_Score 过程的地方。CandidateVotes 和 CurrentCandidate 的类型是正确的。如果我应该发布更多,请告诉我。
此外,错误显示为: Candidates.adb:37:25: "Get_Score" is undefined