Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ada programming in GPS

Tags:

ada

gnat-gps

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'
like image 412
Ben Avatar asked Jun 19 '26 18:06

Ben


1 Answers

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;
like image 65
Simon Wright Avatar answered Jun 24 '26 12:06

Simon Wright