3
votes

I am a beginner with using both the ada language, as well as using GPS. I can't seem to find any solid tutorials to help learn ada or GPS, but that's not my question.

I have tried various simple programs, like this one:

with Win32.crt.Math;
with Interfaces.C;

procedure sqrt is
X : Interfaces.C.Double;
begin
   X := Win32.crt.Math.sqrt(x => 4.0) ;
end sqrt;

I have tried others that are of similar simplicity and found other more complicated ones on the web, and I have really only gotten one to work.

Anyways, I get this error when I try to build:

gnatmake -d -PC:\Users\bqw3960\Desktop\GPS2012\2-two\sqrt.gpr sqrt.adb

gnatbind -x sqrt.ali

gnatlink -o c:\users\bqw3960\desktop\gps2012\2-two\sqrt.exe sqrt.ali

C:\GNAT\Bindings\Win32Ada\win32-crt-math.o(.text+0x1a):win32-crt-math.adb: undefined 

reference to `__imp__HUGE'

gnatlink: cannot call C:\GNAT\bin\gcc.exe

gnatmake: *** link failed.

[2013-06-13 10:53:18] process exited with status 4 (elapsed time: 00.51s)

I figure it is simple but I can't seem to figure it out.

I also sometimes get this when I try to compile after I change something for the first time:

gcc.exe: unrecognized option `-ws'
2
Does a plain old Hello World program compile and link? It kinda looks like a problem with the installing of the Win32 bindings.Marc C
yeah it does, i have gotten only one or two working programs, the hello world, and then a hello world with get(x) and a while loop to have the person guess, that is all i have managed to get working thoughBen
Get one of the older Ada 95 books used from Amazon, you get them for 5$ including shipping. For an indepth study you will need the book by Barnes about Ada 2005, no way around it.Rick

2 Answers

2
votes

What does your sqrt.gpr say? I just tried this, and the gnatlink step said

gnatlink "C:\Documents and Settings\Simon\sqrt.ali" C:\GNAT\2012\lib\win32ada\static\libwin32ada.a -o "C:\Documents and Settings\Simon\sqrt.exe"

which is quite different from yours ... and worked.

My sqrt.gpr said

with "win32ada";
project Sqrt is
   for Main use ("sqrt.adb");
end Sqrt;
0
votes

This is because your sqrt procedure is still running and you are trying to do both compile the solution and run your procedure at the same time. Halt execution of the program and then try compilation. It should work as expected.