I am currently trying to run a program in GPS and this is my first time trying to use Ada and don't quite understand some things to it. I have some code that was told was supposed to run but can't seem to get it running. When I try to compile it or run the code, I keep getting an error message: "end of file expected. file can only be one compilation unit." I also included a photo to help show the problem. I'd appreciate any tips or hints on how to solve this please!
Trying to use GPS for Ada and keep having problems trying to compile and run the code
209 Views Asked by bedboi At
2
There are 2 best solutions below
0
Maxim Reznik
On
If you use GNAT Studio the very first time, then I suggest you to spend a few minutes by reading the tutorial.
Related Questions in ADA
- How to properly handle byte buffers from C to Ada?
- ADA problem with value by reference or post conditions
- Order of evaluation in assignment statements
- Why Ada attribute 'value in this snippet doesn't raise Data_Error but Constraint_Error instead?
- How to write Recursive GCD program in Ada?
- Ada Calendar Arithmetic Difference 0 day between March 27 and March 28 2011
- Access constant as subtype of general access type
- How to conveniently parse a very specific chunk of a plaintext file in Ada?
- STORAGE_ERROR on assignment to array element
- Howto Re-Index an String in Ada?
- How to add < and > check in case ... when?
- How can I have more information in a Predicate_Failure?
- Tasking support in CortexM4-based board
- Receiving a `r' Fatal Error when trying to build basic Ada code
- MSYS2 - mingw64 Installing a package
Related Questions in GNAT
- Unbounded string `ENCODING_ERROR : bad input at Item`
- Linking erros xerces-c on GNAT
- Ada scale exceeds maximum value of 18
- Unexpected Ada Type Compatibility
- Installing Gnatstudio on RPI 4 v7
- Unable to link C source code with Ada static library (Error: libnewapi.a(unit1.o):unit1.adb:undefined reference to `__gnat_rcheck_CE_Overflow_Check')
- Could not find gnatmake binary after MacOS installation
- Possible memory leak using GNAT Regpat? What am I doing wrong?
- Bug in GNAT Get(FRom => SomeString, Item => SomeInteger, Last => Last)?
- Errors trying to run gnattest
- Create a record with a private part
- Is there a way to disable arithmetic operators on a specific type in Ada?
- Error setting the video mode when trying to run the compiled Game_Support example; GNAT Studio;
- How do I get useful data from a UDP socket using GNAT.Sockets in Ada?
- How would I define the __builtin_blendvps256 GCC intrinsic in Ada using GNAT?
Related Questions in GNAT-GPS
- Error setting the video mode when trying to run the compiled Game_Support example; GNAT Studio;
- Trying to use GPS for Ada and keep having problems trying to compile and run the code
- No language defined for the project: Ada GNAT GPS
- adding -gnatp flag to a file/package in GPS
- gprbuild fails to include a file needed for gnatcoll
- How to allow Ada Big_Numbers in GPS Community 2021
- Cannot set key shortcut on GNAT Studio
- Adacore GNATCOLL Postgres library not installing on CentOS 8
- Adacore GNATCOLL library not installing on CentOS 8
- GNAT Studio - Cant use non-core Ada librairies
- How to add vectors in Ada
- pragma export function is not external in Ada executable
- PostgreSQL C API - libq Undefined Reference
- Weird error when compiling 32-bit programs with GCC
- GNAT Studio (GPS) not launching on windows 10
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
From the image, you seem to have a source file that contains both the declaration (or "spec", "specification") of a package named CircularQueue, and the body (the implementation) of that package. For the GNAT compiler and GPS such combined files are not supported. You should put the declaration of the package and the body of the package each into its own source file. In general, for GNAT/GPS each Ada "compilation unit" must be in its own source file. (This is also good for version control and to reduce unnecessary recompilations.)
The package declaration is the first part of your current file, from
to the first occurrence of
That should be in its own file, which (by GNAT/GPS convention) should be called circularqueue.ads. The final "s" stands for "spec" or "specification".
The body of the package forms the rest of your current file, from
to the second (and last) occurrence of
The body should be in its own file, which (by GNAT/GPS convention) should be called circularqueue.adb. The final "b" stands for "body".
The first line of your current source file is a so-called "context clause" and says that your code will use the predefined package Ada.Text_IO. Such context clauses should be put at the start of the spec file and/or the body file, depending on which file needs it. In this case, the spec does not refer to Ada.Text_IO, but the body does, so this context clause should be at the start of the body file (circularqueue.adb).
HTH