windows - How to use GtkAda in command-line? -
i try compile simple gtkada application in command-line, on windows. here app code:
`with gtk.main ;       use gtk.main ;  gtk.window ;     use gtk.window ;  procedure test01    win : gtk_window ; begin    init ;     gtk_new(win) ;    win.show_all ;     main ;  end test01 ;`   compiling with
gcc -c test01.adb -ic:\<<path_to_gtkada\include\gtkada>>, obtain test.ali , test01.o expected.
but how link libs please?
gcc test.o -lc:\<<path_to_gtkada>>\lib   gives:
`test01.o:test01.adb:(.text+0xe): undefined reference `gtk__main__init' test01.o:test01.adb:(.text+0x21): undefined reference `gtk__window__gtk_new' test01.o:test01.adb:(.text+0x3e): undefined reference `__gnat_rcheck_ce_access_check' test01.o:test01.adb:(.text+0x5e): undefined reference `gtk__main__main' c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: test01.o: bad reloc address 0x20 in section `.eh_f rame' c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: final link failed: invalid operation collect2.exe: error: ld returned 1 exit status`   path contains <<path_to_gtkada>>/bin
thank you.
the solution use gnat's project files described in documentation installed compiler, typically in “doc” or "doc/gprbuild” subdirectory.
a simple example project file named “so.gpr” might this:
with "gtkada"; project   source_dirs use (".");  end so;   note part says with "gtkada";. means toolchain inject switches necessary make ada/gtk program.  then, if invoke gnat toolchain this:
$ gnatmake -pso test01.adb   the ada make program call, in sequence, gcc, gnatbind, , gnatlink. each, necessary arguments commands supplied automatically. (depending on edition of gnat using, may use gprbuild.)
so, example on debian/gnu system libgtkada2.24.4-dev installed, see this:
$ gnatmake -pso test01.adb gcc-4.9 -c -i- -gnata /home/bauhaus/news/so/test01.adb gnatbind -shared -x /home/bauhaus/news/so/test01.ali gnatlink /home/bauhaus/news/so/test01.ali -shared-libgcc -l/usr/lib/x86_64-linux-gnu/ -lgtkada -lgdk-x11-2.0 -lgmodule-2.0 -lgtk-x11-2.0 -lgdk-x11-2.0 -lpangocairo-1.0 -latk-1.0 -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lpangoft2-1.0 -lfontconfig -lfreetype -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lx11 -lm -o /home/bauhaus/news/so/test01 $
Comments
Post a Comment