gtk +xml tutorial why not work?

New to FreeBASIC? Post your questions here.
covid19
Posts: 31
Joined: Apr 25, 2020 20:41

Re: gtk +xml tutorial why not work?

Postby covid19 » May 09, 2020 12:24

systemctl wrote:Anyway, I think no one do GTK+ development on Windows because it's cubersome. The homeland of GTK+ is Linux and other Unix-like systems. Might you switch to IUP? IUP is more easier to setup and coding in.


exist a guide step by step for iup ???
another questions exist somthing program for draw gui or i must , for draw call command to command ?
MrSwiss
Posts: 3581
Joined: Jun 02, 2013 9:27
Location: Switzerland

Re: gtk +xml tutorial why not work?

Postby MrSwiss » May 09, 2020 13:42

covid19 wrote:exist a guide step by step for iup ???
Well, at least for the IUP first steps (installing + testing) by me (brand new).

covid19 wrote:another questions exist somthing program for draw gui or i must , for draw call command to command ?
There are 3 examples (translated from C) to test the installation.
See: Libraries/IUP GUI lib (Win/Lin) getting started
IUP documentation (as .chm or .pdf) can be got from: http://webserver2.tecgraf.puc-rio.br/iup/download/

P.S. sorry badidea, just now seen your posted link ...
covid19
Posts: 31
Joined: Apr 25, 2020 20:41

Re: gtk +xml tutorial why not work?

Postby covid19 » May 09, 2020 17:14

so i try to use iup , i follow the guide step by step download a latest version
iup3.28 win64 ming ..... unzip copy file .a in c:\freebasic\lib, run fbide.exe copy the first example

Code: Select all

' IUP_ex1mod.bas -- (c) 2020-05-04, MrSwiss
'
' compile: -s gui
'
#Include "IUP/iup.bi"                   ' static lib's ver. 3.28 (.bi is for 3.15)
                                        ' it is still working "as expected" _
                                        ' maybe without the latest additions

Dim As UByte    bits = SizeOf(Any Ptr) * 8  ' get FBC's bitness w/o preprocessor
Dim As String   msg1 = "Hello FreeBASIC programmers from IUP 3.28" + Chr(10) + _
                       "FB-IUP bindings 3.15 and FBC" + Str(bits) + " ver. " + _
                       __FB_VERSION__, _
                title1 = "FBC + IUP -- Example 1 (modified)"

IupOpen(0, 0)                           ' required
IupMessage(title1, msg1)                ' waits for 'OK' button click
IupClose()                              ' required
' ----- EOF -----

run it and..... drumrolll trtrtrtrttrttrtrtrtrtrtrt
dont go ahahhahahahahha
the code execution cannot proceed because IUP.DLL was not found . reinstallling the program may fix the problem
ahahha nice word
MrSwiss
Posts: 3581
Joined: Jun 02, 2013 9:27
Location: Switzerland

Re: gtk +xml tutorial why not work?

Postby MrSwiss » May 09, 2020 17:27

If you want 'step by step' help, but are NOT prepared to do 'what it clearly states',
then your results will of course: NOT be "as expected".
I've clearly stated "static lib's = *.a" and NOT "dynamic lib's = *.dll".
Because there is a lot more problems associated with: dynamic linking ...

(The *.dll's must be also available to the generated *.exe!)
covid19
Posts: 31
Joined: Apr 25, 2020 20:41

Re: gtk +xml tutorial why not work?

Postby covid19 » May 09, 2020 17:34

but i have copyed a staic lib , and copy a example 1 , like writed here https://www.freebasic.net/forum/viewtop ... 91#p271758
i dont know why give .dll problem

i wrote
unzip copy file .a in c:\freebasic\lib,
MrSwiss
Posts: 3581
Joined: Jun 02, 2013 9:27
Location: Switzerland

Re: gtk +xml tutorial why not work?

Postby MrSwiss » May 09, 2020 17:40

OK, how many static lib's have you copied? I think there should be 15 (in all) and,
you must copy them all (they depend on each other, to run smoothly).
covid19
Posts: 31
Joined: Apr 25, 2020 20:41

Re: gtk +xml tutorial why not work?

Postby covid19 » May 09, 2020 17:54

all inside zip
see a folder foto
https://ibb.co/fXbD9Km
MrSwiss
Posts: 3581
Joined: Jun 02, 2013 9:27
Location: Switzerland

Re: gtk +xml tutorial why not work?

Postby MrSwiss » May 09, 2020 18:06

Well, that clears it. Move them all into <FBC>\lib\win32\ ... (or win64), linux may be different!
They're all there (none in \lib\ itself) plenty of them ...
TJF
Posts: 3599
Joined: Dec 06, 2009 22:27
Location: N47°, E15°
Contact:

Re: gtk +xml tutorial why not work?

Postby TJF » May 09, 2020 18:09

covid19 wrote:hi guys i try torun this tutorial i saw here
https://www.freebasic-portal.de/code-be ... Tv22a8bnhA
this is a code

Code: Select all

' ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
'< main program generated by utility                 GTK+tobac2 V2.2.0 >
'< Hauptprogramm erzeugt von                                           >
'< Generated at / Generierung am                     2010-09-06, 01:24 >
' ---------------------------------------------------------------------
'< Program info:                                                       >
CONST PROG_NAME = "Scribble" '                                         >
CONST PROG_DESC = "Zeichenprogramm" '                                  >
CONST PROG_VERS = "0.0" '                                              >
CONST PROG_YEAR = "2010" '                                             >
CONST PROG_AUTH = "TJF" '                                              >
CONST PROG_MAIL = "Thomas.Freiherr@gmx.net" '                          >
CONST PROG_WEBS = "members.aon.at/tjf" '                               >
'<                                                                     >
'< Description / Beschreibung:                                         >
'< Beispiel DrawArea, einfaches Zeichenprogramm                        >
'<                                                                     >
'< License / Lizenz:                                                   >
'<                                                                     >
'< Redistribution and use in source and binary forms, with or          >
'< without modification, are permitted provided that the following     >
'< conditions are met:                                                 >
'<                                                                     >
'< * Redistributions of source code must retain the above              >
'< copyright notice, this list of conditions and the following         >
'< disclaimer.                                                         >
'<                                                                     >
'< * Redistributions in binary form must reproduce the above           >
'< copyright notice, this list of conditions and the following         >
'< disclaimer in the documentation and/or other materials provided     >
'< with the distribution.                                              >
'<                                                                     >
'< * Neither the name of the author nor the names of its               >
'< contributors may be used to endorse or promote products derived     >
'< from this software without specific prior written permission.       >
'<                                                                     >
'< THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS                  >
'< AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED                 >
'< WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES   >
'< OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE             >
'< ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER               >
'< OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,     >
'< SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT    >
'< LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF    >
'< USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED     >
'< AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT         >
'< LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN   >
'< ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE     >
'< POSSIBILITY OF SUCH DAMAGE.                                         >
'<                                                                     >
' ---------------------------------------------------------------------
'< Please prefer GNU GENERAL PUBLIC LICENSE to support open software.  >
'< For more information please visit:               http://www.fsf.org >
'<                                                                     >
'< Bitte bevorzugen Sie die GNU GENERAL PUBLIC LICENSE und             >
'< unterstuetzen Sie mit Ihrem Programm die freie Software             >
'< Mehr Informationen finden Sie unter:             http://www.fsf.org >
' ---------------------------------------------------------------------
'<  GTK+tobac:             general init / Allgemeine Initialisierungen >
  '  #INCLUDE "gtk/GTK-2.18.6_TJF.bi" '   GTK+library / GTK+ Bibliothek >
  #include once "gtk/gtk.bi"
    gtk_init(@__FB_ARGC__, @__FB_ARGV__) '     start GKT / GTK starten >
'<  GTK+tobac:                                   end block / Blockende >
' vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv

/' Backing pixmap for drawing area '/
DIM SHARED AS GdkPixmap PTR PIXMAP = NULL
DECLARE SUB draw_brush(BYVAL widget AS GtkWidget PTR, _
                       BYVAL x AS gdouble, _
                       BYVAL y AS gdouble)

' ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
'< _tobac.bas modul generated by utility             GTK+tobac2 V2.2.0 >
'< Modul _tobac.bas erzeugt von                                        >
'< Generated at / Generierung am                     2010-09-06, 02:45 >
' vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv

IF gtk_check_version(2, 16, 0) THEN
  ?"Fehler/Error (GTK-Version): Version zu alt"
  END -1
END IF

DIM AS STRING GUISTR
DIM SHARED AS GtkBuilder PTR XML
DIM SHARED AS GObject PTR _
  WinScribble, Draw1, ButQuit

XML = gtk_builder_new()

SCOPE
  DIM AS GError PTR meld

  ' ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  '< _gui.bas modul generated by utility               GTK+tobac2 V2.2.0 >
  '< Modul _gui.bas erzeugt von                                          >
  '< Generated at / Generierung am                     2010-09-06, 02:45 >
  ' vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv

  GUIstr =_
  "<?xml version=""1.0""?>"+_
  "<interface>"+_
  "<requires lib=""gtk+"" version=""2.16""/>"+_
  "<!-- interface-naming-policy project-wide -->"+_
  "<object class=""GtkWindow"" id=""WinScribble"">"+_
  "<signal name=""destroy"" handler=""gtk_main_quit""/>"+_
  "<child>"+_
  "<object class=""GtkVBox"" id=""vbox1"">"+_
  "<property name=""visible"">True</property>"+_
  "<child>"+_
  "<object class=""GtkDrawingArea"" id=""Draw1"">"+_
  "<property name=""width_request"">200</property>"+_
  "<property name=""height_request"">200</property>"+_
  "<property name=""visible"">True</property>"+_
  "<property name=""events"">GDK_EXPOSURE_MASK | GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_LEAVE_NOTIFY_MASK | GDK_STRUCTURE_MASK</property>"+_
  "<signal name=""button_press_event"" handler=""on_Draw1_button_press_event""/>"+_
  "<signal name=""motion_notify_event"" handler=""on_Draw1_motion_notify_event""/>"+_
  "<signal name=""expose_event"" handler=""on_Draw1_expose_event""/>"+_
  "<signal name=""configure_event"" handler=""on_Draw1_configure_event""/>"+_
  "</object>"+_
  "<packing>"+_
  "<property name=""position"">0</property>"+_
  "</packing>"+_
  "</child>"+_
  "<child>"+_
  "<object class=""GtkButton"" id=""ButQuit"">"+_
  "<property name=""label"" translatable=""yes"">Quit</property>"+_
  "<property name=""visible"">True</property>"+_
  "<property name=""can_focus"">True</property>"+_
  "<property name=""receives_default"">True</property>"+_
  "<signal name=""clicked"" handler=""gtk_main_quit""/>"+_
  "</object>"+_
  "<packing>"+_
  "<property name=""expand"">False</property>"+_
  "<property name=""fill"">False</property>"+_
  "<property name=""position"">1</property>"+_
  "</packing>"+_
  "</child>"+_
  "</object>"+_
  "</child>"+_
  "</object>"+_
  "</interface>"
  IF 0 = gtk_builder_add_from_string(XML, SADD(GUISTR), LEN(GUISTR), @meld) THEN
    WITH *meld
      ?"Fehler/Error (GTK-Builder):"
      ?*.message
    END WITH
    END -1
  END IF
END SCOPE

WinScribble = gtk_builder_get_object(XML, "WinScribble")
Draw1 = gtk_builder_get_object(XML, "Draw1")
ButQuit = gtk_builder_get_object(XML, "ButQuit")

' ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
'< callback modul generated by utility               GTK+tobac2 V2.2.0 >
'< callback-Modul erzeugt von                                          >
'< Generated at / Generierung am                     2010-09-06, 01:24 >
' vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv

FUNCTION on_Draw1_button_press_event CDECL ALIAS "on_Draw1_button_press_event" _
         (BYVAL widget AS GtkWidget PTR, _
          BYVAL event AS GdkEventButton PTR) AS gboolean EXPORT
  IF event->button = 1 THEN IF PIXMAP THEN draw_brush(widget, event->x, event->y)
  RETURN TRUE
END FUNCTION

' ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
'< callback modul generated by utility               GTK+tobac2 V2.2.0 >
'< callback-Modul erzeugt von                                          >
'< Generated at / Generierung am                     2010-09-06, 01:24 >
' vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv

FUNCTION on_Draw1_motion_notify_event CDECL ALIAS "on_Draw1_motion_notify_event" _
         (BYVAL widget AS GtkWidget PTR, _
          BYVAL event AS GdkEventMotion PTR) AS gboolean EXPORT
  DIM AS INTEGER x, y
  DIM AS GdkModifierType state

  IF event->is_hint THEN
    gdk_window_get_pointer(event->window, @x, @y, @state)
  ELSE
    x = event->x
    y = event->y
    state = event->state
  END IF

  IF state AND GDK_BUTTON1_MASK THEN IF PIXMAP THEN draw_brush(widget, x, y)
  RETURN TRUE
END FUNCTION

' ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
'< callback modul generated by utility               GTK+tobac2 V2.2.0 >
'< callback-Modul erzeugt von                                          >
'< Generated at / Generierung am                     2010-09-06, 01:24 >
' vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv

FUNCTION on_Draw1_expose_event CDECL ALIAS "on_Draw1_expose_event" _
         (BYVAL widget AS GtkWidget PTR, _
          BYVAL event AS GdkEventExpose PTR) AS gboolean EXPORT
  gdk_draw_drawable(widget->window, _
                    widget->style->fg_gc(gtk_widget_get_state(widget)), _
                    PIXMAP, _
                    event->area.x, event->area.y, _
                    event->area.x, event->area.y, _
                    event->area.width, event->area.height)
  RETURN FALSE
END FUNCTION

' ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
'< callback modul generated by utility               GTK+tobac2 V2.2.0 >
'< callback-Modul erzeugt von                                          >
'< Generated at / Generierung am                     2010-09-06, 01:24 >
' vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv

FUNCTION on_Draw1_configure_event CDECL ALIAS "on_Draw1_configure_event" _
        (BYVAL widget AS GtkWidget PTR, _
         BYVAL event AS GdkEventConfigure PTR) AS gboolean EXPORT
  IF PIXMAP THEN g_object_unref(pixmap)

  PIXMAP = gdk_pixmap_new(widget->window, _
                          widget->allocation.width, _
                          widget->allocation.height, _
                          -1)
  gdk_draw_rectangle(PIXMAP, _
                     widget->style->white_gc, _
                     TRUE, _
                     0, 0, _
                     widget->allocation.width, _
                     widget->allocation.height)
  RETURN TRUE
END FUNCTION


SUB draw_brush(BYVAL widget AS GtkWidget PTR, _
               BYVAL x AS gdouble, _
               BYVAL y AS gdouble)
  DIM AS GdkRectangle update_rect

  update_rect.x = x - 5
  update_rect.y = y - 5
  update_rect.width = 10
  update_rect.height = 10
  gdk_draw_rectangle(PIXMAP, _
                     widget->style->black_gc, _
                     TRUE, _
                     update_rect.x, update_rect.y, _
                     update_rect.width, update_rect.height)
  gtk_widget_queue_draw_area(widget, _
                             update_rect.x, update_rect.y, _
                             update_rect.width, update_rect.height)
END SUB

' ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
'<  GTK+tobac:   run GTK main, then end / GTK Hauptschleife, dann Ende >
    gtk_builder_connect_signals(XML, 0) '           callbacks anbinden >
    gtk_widget_show_all(GTK_WIDGET(WinScribble)) 'ptfenster darstellen >
    gtk_main() '                             main loop / Hauptschleife >
    g_object_unref(XML) '               dereference / Referenz abbauen >
'<  GTK+tobac:                                   end block / Blockende >
' vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv

' you may unref files here / ggf. Dateien hier schliessen

END 0 ' finish with return code 0 / Ende mit Returncode 0


return me

Code: Select all

Command executed:
"C:\FreeBasic\fbc.exe" "C:\Users\pc\Desktop\test_freebasic\FBIDETEMP.bas"

Compiler output:
C:\Users\pc\Desktop\test_freebasic\FBIDETEMP.bas(68) error 41: Variable not declared, NULL in 'DIM SHARED AS GdkPixmap PTR PIXMAP = NULL'
C:\Users\pc\Desktop\test_freebasic\FBIDETEMP.bas(68) warning 4(1): Suspicious pointer assignment
C:\Users\pc\Desktop\test_freebasic\FBIDETEMP.bas(85) error 14: Expected identifier, found 'GtkBuilder' in 'DIM SHARED AS GtkBuilder PTR XML'
C:\Users\pc\Desktop\test_freebasic\FBIDETEMP.bas(89) error 41: Variable not declared, XML in 'XML = gtk_builder_new()'
C:\Users\pc\Desktop\test_freebasic\FBIDETEMP.bas(143) error 41: Variable not declared, gtk_builder_add_from_string in 'IF 0 = gtk_builder_add_from_string(XML, SADD(GUISTR), LEN(GUISTR), @meld) THEN'
C:\Users\pc\Desktop\test_freebasic\FBIDETEMP.bas(152) error 41: Variable not declared, gtk_builder_get_object in 'WinScribble = gtk_builder_get_object(XML, "WinScribble")'
C:\Users\pc\Desktop\test_freebasic\FBIDETEMP.bas(152) warning 4(1): Suspicious pointer assignment
C:\Users\pc\Desktop\test_freebasic\FBIDETEMP.bas(153) error 67: Array not dimensioned, before '(' in 'Draw1 = gtk_builder_get_object(XML, "Draw1")'
C:\Users\pc\Desktop\test_freebasic\FBIDETEMP.bas(153) warning 4(1): Suspicious pointer assignment
C:\Users\pc\Desktop\test_freebasic\FBIDETEMP.bas(154) error 67: Array not dimensioned, before '(' in 'ButQuit = gtk_builder_get_object(XML, "ButQuit")'
C:\Users\pc\Desktop\test_freebasic\FBIDETEMP.bas(154) warning 4(1): Suspicious pointer assignment
C:\Users\pc\Desktop\test_freebasic\FBIDETEMP.bas(203) error 41: Variable not declared, gtk_widget_get_state in 'widget->style->fg_gc(gtk_widget_get_state(widget)), _'
C:\Users\pc\Desktop\test_freebasic\FBIDETEMP.bas(257) error 41: Variable not declared, gtk_builder_connect_signals in 'gtk_builder_connect_signals(XML, 0) '           callbacks anbinden >'
C:\Users\pc\Desktop\test_freebasic\FBIDETEMP.bas(260) warning 1(1): Passing scalar as pointer, at parameter 1 of G_OBJECT_UNREF()

Results:
Compilation failed

System:
FBIde: 0.4.6
fbc:   FreeBASIC Compiler - Version 0.23.0 (08-14-2011) for win32 (target:win32)
OS:    Windows NT 6.2 (build 9200)

why this problem?

This is an old example from 2010, compiled against GTK+2.18.6 (as you can seen in the source code).

Meanwhile GTK changed all drawing stuff using cairo in versions 3.x, which is incompatible. In order to compile that old example you'll need GTK binaries/headers > 2.18, but < 3.0.
covid19
Posts: 31
Joined: Apr 25, 2020 20:41

Re: gtk +xml tutorial why not work?

Postby covid19 » May 09, 2020 18:23

MrSwiss wrote:Well, that clears it. Move them all into <FBC>\lib\win32\ ... (or win64), linux may be different!
They're all there (none in \lib\ itself) plenty of them ...

i use windows dont worry i did do this test
1 crete folder <FBC>\lib\win64 and move all file .a run first example , return the same error
2 copy .a file in folder <FBC>\lib\win32\ run first example , retrun the same error
3 download a static library 32 bit version unzip and copy all in <FBC>\lib\win32\ run first example , return the same error
4 move .a library in <FBC>\lib , run first example , return the same error


This is an old example from 2010, compiled against GTK+2.18.6 (as you can seen in the source code).

Meanwhile GTK changed all drawing stuff using cairo in versions 3.x, which is incompatible. In order to compile that old example you'll need GTK binaries/headers > 2.18, but < 3.0.

sorry if i dont upgrade also example ahahahhahah :D
but exist some example GTK 3 with XML step by step and sure worked ???
MrSwiss
Posts: 3581
Joined: Jun 02, 2013 9:27
Location: Switzerland

Re: gtk +xml tutorial why not work?

Postby MrSwiss » May 09, 2020 18:30

One more try: the libraries bitness (32bit or 64bit) must match the compilers bitness.
The compiler seems to be: FBC32 (on your install) therefore, you must use the 32bit
IUP static libraries (only) to have success ...
TJF
Posts: 3599
Joined: Dec 06, 2009 22:27
Location: N47°, E15°
Contact:

Re: gtk +xml tutorial why not work?

Postby TJF » May 09, 2020 19:01

covid19 wrote:but exist some example GTK 3 with XML step by step and sure worked ???
Did you try GtkBuilder.bas and all the other stuff in the examples folder?
covid19
Posts: 31
Joined: Apr 25, 2020 20:41

Re: gtk +xml tutorial why not work?

Postby covid19 » May 09, 2020 20:35

MrSwiss wrote:One more try: the libraries bitness (32bit or 64bit) must match the compilers bitness.
The compiler seems to be: FBC32 (on your install) therefore, you must use the 32bit
IUP static libraries (only) to have success ...

4
just tested with 64 and 32

i just wrote
3 download a static library 32 bit version unzip and copy all in <FBC>\lib\win32\ run first example , return the same error
4 move .a library in <FBC>\lib , run first example , return the same error


Did you try GtkBuilder.bas and all the other stuff in the examples folder?

yes the gtkbuilder.bas start and work create a file , but when i try to run it ...............try to guess what it does?
covid19
Posts: 31
Joined: Apr 25, 2020 20:41

Re: gtk +xml tutorial why not work?

Postby covid19 » May 09, 2020 20:59

Did you try GtkBuilder.bas and all the other stuff in the examples folder?

yes the gtkbuilder.bas start and work create a file , but when i try to run it ...............try to guess what it does?[/quote]


sorry i did do a mistake GtkBuilder.bas with gladetobac i confused
i download now GtkBuilder.bas by here
https://github.com/freebasic/fbc/blob/1 ... uilder.bas

aand i tested
return thsi

Code: Select all

Command executed:
"C:\FreeBasic\fbc.exe" "C:\Users\pc\Desktop\test_freebasic\FBIDETEMP.bas"

Compiler output:
C:\FreeBasic\inc\gtk\glib\gmacros.bi(14) error 4: Duplicated definition, G_STRLOC in '#define G_STRLOC ":" + str$(__LINE__)'
C:\FreeBasic\inc\gtk\glib\gmacros.bi(15) warning 39(0): Redefinition of intrinsic
C:\FreeBasic\inc\gtk\glib\gmacros.bi(16) warning 39(0): Redefinition of intrinsic
C:\FreeBasic\inc\gtk\glib\config.bi(23) error 4: Duplicated definition in 'type gint32 as integer'
C:\FreeBasic\inc\gtk\glib\config.bi(24) error 4: Duplicated definition in 'type guint32 as uinteger'
C:\FreeBasic\inc\gtk\glib\config.bi(29) error 4: Duplicated definition, G_HAVE_GINT64 in '#define G_HAVE_GINT64 1'
C:\FreeBasic\inc\gtk\glib\config.bi(37) error 4: Duplicated definition, GLIB_SIZEOF_VOID_P in '#define GLIB_SIZEOF_VOID_P 4'
C:\FreeBasic\inc\gtk\glib\config.bi(38) error 4: Duplicated definition, GLIB_SIZEOF_LONG in '#define GLIB_SIZEOF_LONG 4'
C:\FreeBasic\inc\gtk\glib\config.bi(41) error 4: Duplicated definition in 'type gssize as integer'
C:\FreeBasic\inc\gtk\glib\config.bi(42) error 4: Duplicated definition in 'type gsize as uinteger'
C:\FreeBasic\inc\gtk\glib\config.bi(47) error 4: Duplicated definition, GLIB_MAJOR_VERSION in '#define GLIB_MAJOR_VERSION 2'
C:\FreeBasic\inc\gtk\glib\config.bi(48) error 4: Duplicated definition, GLIB_MINOR_VERSION in '#define GLIB_MINOR_VERSION 6'
C:\FreeBasic\inc\gtk\glib\config.bi(48) error 133: Too many errors, exiting

Results:
Compilation failed

System:
FBIde: 0.4.6
fbc:   FreeBASIC Compiler - Version 1.07.1 (2019-09-27), built for win32 (32bit)
OS:    Windows NT 6.2 (build 9200)


if o comment in gmacros.bi
this line
#define G_STRLOC ":" + str$(__LINE__)
#define FALSE 0
#define TRUE 1
not return error but not appear nothing only one sec a cmd
TJF
Posts: 3599
Joined: Dec 06, 2009 22:27
Location: N47°, E15°
Contact:

Re: gtk +xml tutorial why not work?

Postby TJF » May 10, 2020 7:05

covid19 wrote:yes the gtkbuilder.bas start and work create a file , but when i try to run it ...............try to guess what it does?
Nonsens! Don't try to play guessing games!

covid19 wrote:sorry i did do a mistake GtkBuilder.bas with gladetobac i confused
i download now GtkBuilder.bas by here
https://github.com/freebasic/fbc/blob/1 ... uilder.bas

aand i tested
return thsi

Code: Select all

Command executed:
"C:\FreeBasic\fbc.exe" "C:\Users\pc\Desktop\test_freebasic\FBIDETEMP.bas"

Compiler output:
C:\FreeBasic\inc\gtk\glib\gmacros.bi(14) error 4: Duplicated definition, G_STRLOC in '#define G_STRLOC ":" + str$(__LINE__)'
C:\FreeBasic\inc\gtk\glib\gmacros.bi(15) warning 39(0): Redefinition of intrinsic
C:\FreeBasic\inc\gtk\glib\gmacros.bi(16) warning 39(0): Redefinition of intrinsic
C:\FreeBasic\inc\gtk\glib\config.bi(23) error 4: Duplicated definition in 'type gint32 as integer'
C:\FreeBasic\inc\gtk\glib\config.bi(24) error 4: Duplicated definition in 'type guint32 as uinteger'
C:\FreeBasic\inc\gtk\glib\config.bi(29) error 4: Duplicated definition, G_HAVE_GINT64 in '#define G_HAVE_GINT64 1'
C:\FreeBasic\inc\gtk\glib\config.bi(37) error 4: Duplicated definition, GLIB_SIZEOF_VOID_P in '#define GLIB_SIZEOF_VOID_P 4'
C:\FreeBasic\inc\gtk\glib\config.bi(38) error 4: Duplicated definition, GLIB_SIZEOF_LONG in '#define GLIB_SIZEOF_LONG 4'
C:\FreeBasic\inc\gtk\glib\config.bi(41) error 4: Duplicated definition in 'type gssize as integer'
C:\FreeBasic\inc\gtk\glib\config.bi(42) error 4: Duplicated definition in 'type gsize as uinteger'
C:\FreeBasic\inc\gtk\glib\config.bi(47) error 4: Duplicated definition, GLIB_MAJOR_VERSION in '#define GLIB_MAJOR_VERSION 2'
C:\FreeBasic\inc\gtk\glib\config.bi(48) error 4: Duplicated definition, GLIB_MINOR_VERSION in '#define GLIB_MINOR_VERSION 6'
C:\FreeBasic\inc\gtk\glib\config.bi(48) error 133: Too many errors, exiting

Results:
Compilation failed

System:
FBIde: 0.4.6
fbc:   FreeBASIC Compiler - Version 1.07.1 (2019-09-27), built for win32 (32bit)
OS:    Windows NT 6.2 (build 9200)


if o comment in gmacros.bi
this line
#define G_STRLOC ":" + str$(__LINE__)
#define FALSE 0
#define TRUE 1
not return error but not appear nothing only one sec a cmd
Yes, that's the example I mentioned above. It worked using the headers shipped at this time. Meanwhile the FB headers got renewed. The error messages are coming from the compiler. The new FB bindings obviously do not work (which version did you install?). There're errors at least in the glib part. It's most likely that you'll also see such error messages when you switch to GTK-3 by uncommenting the statement

Code: Select all

'#DEFINE __USE_GTK3__


In that case I recommend to install the binaries I mentioned in the following post (in folder C:\opt\GTK3 and/or C:\opt\GTK2)

viewtopic.php?f=2&t=28495&p=271888#p271888

And to install my headers from (the complete Gir folder in to C:\FreeBasic\inc\)

https://github.com/DTJF/gir_headers

Adapt the beginning of the source like

Code: Select all

LIBPATH="C:\opt\GTK3"
'#INCLUDE ONCE "gtk/gtk.bi"
#INCLUDE ONCE "Gir/GTK-3.0.bi"
'#INCLUDE ONCE "Gir/_GLibMacros-2.0.bi"
The last line is optional, it may be necessary when your code contains macro stuff.

Return to “Beginners”

Who is online

Users browsing this forum: No registered users and 12 guests