[gtkada] Problem Linking a GtkAda Tutorial Program in a New Installation

Minder, Lawrence - ES/IEWS Lawrence.Minder at itt.com
Fri Jun 5 03:55:57 CEST 2009


Thank-You Dmitry for your response.

I looked at the gtkada.gpr file you mentioned and found it to be a project file for a UNIX system, and a project library file at that.

After many changes and tests, I morphed the file into a Windows GNAT compiler project main file for the GtkAda's tutorial hello.adb program, naming it hello.gpr.  I am not sure if this was the best approach, as I am totally new to Ada, the GNAT compiler and the GPS GPL IDE, but I did find that it worked.

I saved this GPR file to a text file and slightly reformatted it for this Email.  It is listed below.  Thanx again for putting me on the right path ... Larry Minder



Contents of File:  hello.gpr  (From the GtkAda tutorial Sub-Folder
================               helloworld)


project Hello is

   for Main use ("hello.adb");
   for Source_Dirs use ("C:\---MY_TEST_FOLDER_NAME---\GTKADA\Testing\helloworld");
   for Object_Dir use "C:\---MY_TEST_FOLDER_NAME---\GTKADA\Testing\helloworld";

   package Builder is
      for Default_Switches ("ada") use ("-IC:\GtkAda\include\gtkada");
   end Builder;

   package Compiler is
      for Default_Switches ("ada") use ("-g");
   end Compiler;

   package Binder is
      for Default_Switches ("ada") use ("-g");
   end Binder;

   package Linker is
      for Default_Switches ("ada") use ("-Wl,-luuid", "-lgtkada", "-lgtk-win32-2.0.dll",
"-lgdk-win32-2.0.dll", "-latk-1.0.dll", "-lgdk_pixbuf-2.0.dll", "-ljpeg", "-lpng",
"-lpangocairo-1.0.dll", "-lcairo.dll", "-lpangowin32-1.0.dll", "-lpango-1.0.dll",
"-lgobject-2.0.dll", "-lgmodule-2.0.dll", "-lglib-2.0.dll", "-lintl", "-LC:\GtkAda\lib", "-LC:\GtkAda\lib\gtkada\static", "-LC:\GtkAda\include\gtkada");
   end Linker;

end Hello;






-----Original Message-----
From: gtkada-bounces at lists.adacore.com [mailto:gtkada-bounces at lists.adacore.com] On Behalf Of Dmitry A. Kazakov
Sent: Thursday, June 04, 2009 3:36 PM
To: gtkada
Subject: Re: [gtkada] Problem Linking a GtkAda Tutorial Program in a New Installation

On Thu, 4 Jun 2009 14:22:06 -0400, you wrote:

> I am attending an Adacore training class on Ada Fundamentals this week,
> and am trying to get the GtkAda software package working as an extra
> exercise while the instructor is still available..

[...]

> Per the Gtkada User Guide, I am trying to compile one of the tutorial programs using the Windows command line as follows:
>
> Gnatmake C:\GtkAda\share\examples\gtkada\tutorial\helloworld\hello.adb -IC:\Gtkada\include\gtkada
>
> I get the following series of messages:
>
>    gcc -c -IC:\Gtkada\include\gtkada hello.adb
>    gcc -c -IC:\Gtkada\include\gtkada hello_package.adb
>    gnatbind -IC:\Gtkada\include\gtkada -x hello.ali
>    gnatlink hello.ali
>    ...
>    ... numerous messages similar to the following
>    ...
>    b~hello.o:b~hello.adb:...: undefined reference to 'gdk__display_E'
>    b~hello.o:b~hello.adb:...: undefined reference to 'gdk__event_E'
>    b~hello.o:b~hello.adb:...: undefined reference to 'gdk__bitmap_E'
>    b~hello.o:b~hello.adb:...: undefined reference to 'gdk__pixmap_E'
>    ...
>    ... numerous messages similar to the above
>    ...
>    collect2: ld returned 1 exit status
>    gnatlink: error when calling C:\GNAT\2008\bin/gcc.exe
>    gnatmake: *** link failed.
>
> It appears I am missing a link library reference, but I do not know how to
> specify it and which of the many GtkAda folders to point to.  In the
> windows environment PATH are the two folders:  C:\GNAT\2008\bin and
> C:\GtkAda\bin.  The course instructor suggested I write this Email for
> assistance.

Hmm, he should have better advised you to use the GPS and the gpr project
files distributed with GtkAda.

Anyways, if you for some reason want to use bare gnatmake then under
Windows you indeed have to specify all libraries you need. There are a few
of them, the exact list is in the gtkada.gpr file.

The command might look like:

gnatmake -static -IC:/GtkAda/include/gtkada hello.adb -largs
-LC:/GtkAda/lib/gtkada -lgtkada -LC:/GtkAda/lib -lgtk-win32-2.0
-lgdk-win32-2.0 -lglib-2.0 -lgobject-2.0 -lgdk_pixbuf-2.0 -lpango-1.0
-mwindows

(I assumed static linking. Under Linux there is a script you can add to the
command line in order get all libraries: `gtkada-config --static`)

--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
_______________________________________________
gtkada mailing list
gtkada at lists.adacore.com
http://lists.adacore.com/mailman/listinfo/gtkada

This e-mail and any files transmitted with it may be proprietary and are intended solely for the use of the individual or entity to whom they are addressed. If you have received this e-mail in error please notify the sender.
Please note that any views or opinions presented in this e-mail are solely those of the author and do not necessarily represent those of ITT Corporation. The recipient should check this e-mail and any attachments for the presence of viruses. ITT accepts no liability for any damage caused by any virus transmitted by this e-mail.



More information about the gtkada mailing list