I am debugging some simulation software that has been written in two parts- one part using C++, and the other using Ada. On the GUI, there are a few variables displaying information about an entity as it moves from point A to point B, such as the Time To Go (time it will take to complete that leg of the journey given its current speed & any other factors, such as wind) and ETA. One of these values is incorrect.
It seems that the value displayed is coming from part of the Ada code:
--update the legETAValid attribute
this.steeringData.legETAValid := newSteeringData.legTTGValid;
I noticed on the above line, that an incorrect value is being passed to the variable that is being displayed on the GUI, so I changed the line to the vale that should be displayed:
this.steeringData.legETAValid := newSteeringData.legETAValid;
However, when I try to build and run this code, I get a compile error that says: "no selector "legETAValid" for type "SteeringData_record" defined at...."
Having never used Ada before, I'm unsure what this compile error means... is it similar to an "undeclared identifier" in C/C++? I have tried doing a 'Find all references' on the variable, and there are other places in the project where it is being used, so I wouldn't have thought that it is an 'undeclared identifier'... What does this error mean?
Edit 04/02/2015 @ 09:10
The variable is declared in a .ads file with the line:
legETAValid : Boolean := false;
type “SteeringData_record" defined at ...there won’t be a componentlegETAValid. I don’t know a lot about the subject, but it seems at least possible that the ETA to be displayed would - provided that the TTG is valid - be found by adding the TTG to the current time. In any case, why would a flag that the ETA is valid affect the ETA that is displayed? It might affect whether the ETA is displayed at all. So the original code may well be correct as far as the validity is concerned. - Simon Wrightusewouldn't be a factor in this case. It only affects what identifiers would be directly visible, i.e. without following a period. - ajblegETAValidmust be a record component and not a function (since you've got it on the left side of:=), the only reason I can think of why the selector might be legal in some places and not others is that the record type is private (type T is private), or is a private extension (type T is new T2 with private). In that case, the component would be visible in the package where the record is declared (after the declaration), and in parts of packages that are children of that package. It won't be visible anywhere else, because it's private. - ajbthis.steeringDataon the left is the same as the type ofnewSteeringDataon the right? - Simon Wright