1
votes

I have a program that is written in Ada, and I need to compile it. When I do so, I get a "does not contain expected unit" error, and it says it is expecting a spec but found a body. I need it compile it, and I don't know about Ada. I am using the gnat compiler. and i cant put any code up but i can say that it is a adb file with other ads files in the folder.

1
What compiler? What is the code? What is the file name? We need something to go on. - Marc C
@Marc is right. Often the actual error messages output by the compiler will help us a lot (and as you get used to the compiler they will help you; not much consolation right now, I know!) - Simon Wright

1 Answers

1
votes

The error :

"does not contain expected unit" 

usually occurs when the name of the unit does not match the file name (package body aaa.bbb needs to be in file aaa-bbb.adb and package aaa.bbb needs to be in aaa-bbb.ads)

"expecting a spec but found a body"

probably means you have a mismatch between the contents of the file and the file extension (ads or adb)

Beyond this i can only upvote the comment by Marc C