0

I'm trying to get package references resolved during a build, using GNAT Programming Suite (hosted on Win XP). In the Builder Results, I get errors like this one:

file "ac_configuration_s.ada" not found

Clicking on the error takes me to a line like this:

with

    Ac_Configuration,
    Dispense_Timer,
    ...

The first item (Ac_Configuration) isn't resolved, but the second item (Dispense_Time) is resolved. I have several others that do or don't resolve. All of the files in question (spec and body) are identified as source files.

When I hover my mouse over the line with the error, a popup shows up that offers this:

(Cross-references info not up to date. This is a guess.)
Ac_Configuration
local package declared at D_Ac_Config_S.Ada:85

The guess is correct, but I don't know how to use this. How do I get this to correctly build?

Update

Here is teh call to gcc

gcc -c "-gnatec=C:\Source\build\GNAT-TEMP-000001.TMP" -I- -gnatA
-x ada "-gnatem=C:\Source\build\GNAT-TEMP-000002.TMP" "C:\Source\C_Cbt_Main_B.Ada"

I don't see a reference to teh "miimal" switch.

In this case, there is no corresponding body file file D_Ac_Config_S.Ada. So the is no body file to compile separately.

When I right click on the package reference inside the with, I can goto the declaration of Ac_Configuration and every other package name that is the source of an error. So these lreferences are being resolved somehow.

By the way, I have not used ADA before, so I'm still trying to understand everything.

Jim
  • 5,940
  • 9
  • 44
  • 91

2 Answers2

2

It looks as though you're using _s.ada as the suffix for specs, and I'm guessing _b.ada for bodies?

GNAT may have difficulty with this naming convention. It's possible, using a GNAT Project file (.gpr), to alter GNAT's default convention ({unit-name}.ads for specs, {unit-name}.adb for bodies) but the rules (see "Spec_Suffix") say "It cannot start with an underscore followed by an alphanumeric character" (I haven't tried this, but you can see that it would confuse the issue if you had a package Foo_S, for example).
LATER: It turns out that GNAT (GPL, 4.7, 4.8) is quite happy with your suffixes!

If the package Ac_Configuration is really a local package declared at line 85 of D_Ac_Config_S.Ada, then there's your problem; you can only with a library unit, which in this case would be D_Ac_Config.

with D_Ac_Config;
...
package Foo is
   ...
   Bar : D_Ac_Config.Ac_Configuration.Baz;

I wonder whether D_Ac_Config_S.Ada (for example) actually contains multiple Ada units? (if so, compiling that file should result in a compilation error such as end of file expected, file can have only one compilation unit). GNAT doesn't support this at compile time, providing instead a utility gnatchop.

Would it be possible to just gnatchop all the source and be done with it?

Simon Wright
  • 25,108
  • 2
  • 35
  • 62
  • You're right about the naming and suffixes. I'll have to think about what you're saying. This is deployed code, which I inherited. So I'm wondering if there is some version variation that may account for what you say is the problem having worked in the past. Several of the errors seem to be consistent this way, though. – Jim Feb 13 '13 at 22:24
0

Hm, I think it sounds like the compiler's got a bad set of objects/ALIs it's working with, hence the cross-reference not up to date error. (Usually the compiler's good about keeping things up to date; but you may want to check to see if the "minimal recompilation" switch is set for the project.)

Have you tried compiling just the ["owning"] file D_Ac_Config_S.Ada? (i.e. if it were a spec, go to the corresponding body and compile that.) That should force its ALI/object files to be updated.

Then try building as normal.

-- PS: you might have to clean first.

Shark8
  • 4,095
  • 1
  • 17
  • 31
  • To check `Minimal Recompilation` go to `Project` > `Edit Project Properties`, then go to the `Switches` tab of the dialog that pops up, it should be the default tab (`gnatmake`) under that tab. – Shark8 Feb 13 '13 at 22:45