On the command line, gnatmake
will happily compile a file which contains Ada code but has the extension .gpr
. GPS knows "better" than that, and insists on treating myfirstprogram.gpr
as a GNAT Project file, which of course it isn't.
You'll find life with GNAT much easier if you stick with its file naming conventions: .ads
for a spec, .adb
for a body, and the file name needs to be the unit name in lower case. In your case, the file should have been called hello.adb
.
The simplest approach to creating a GNAT project file in GPS is to go to the Project menu and select New. The only places where you must enter data are on the "Naming the project" page (you might choose firstproject
!) and the "Main files" page, where you'd click on the blue + to add hello.adb
; you can Forward through the others.
After adding the main file, you can click Apply to install the new project file; now you can Build all and Run.
You may find the GPS tutorial helpful (Help menu, GPS ...)