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 11, 2020 10:09

but sorry is just installed and you tel me is old
i want 64 bit not 32 at this point if i must reinstall
TJF
Posts: 3604
Joined: Dec 06, 2009 22:27
Location: N47°, E15°
Contact:

Re: gtk +xml tutorial why not work?

Postby TJF » May 11, 2020 11:05

covid19 wrote:but sorry is just installed and you tel me is old
Obviuosly you didn't clean up your box. Instead you "just installed" the new files in to an old folder.
covid19 wrote:i want 64 bit not 32 at this point if i must reinstall
This is the first time you talk about 64 bit. Note: not only the compiler, but also the Gtk binaries must be 64 bit. I provided a link for 64 bit Gtk-3.24 binaries above.
Xusinboy Bekchanov
Posts: 254
Joined: Jul 26, 2018 18:28

Re: gtk +xml tutorial why not work?

Postby Xusinboy Bekchanov » May 11, 2020 11:25

covid19 wrote:but sorry is just installed and you tel me is old
i want 64 bit not 32 at this point if i must reinstall

For compilation took the following steps:
1) download and unzip FreeBASIC-1.07.1-win64 (.7z archive 64-bit version): viewtopic.php?f=1&p=264580#p264580
2) Add gtk3 64-bit lib to the folder \FreeBASIC-1.07.1-win64\lib\win64
Here I inserted gtk3 64-bit lib, which I downloaded through mingw64:
https://drive.google.com/file/d/1zRNNat ... sp=sharing
3) Installed the gtk3 64-bit runtime from this site:
https://sourceforge.net/projects/gtk3win/files/
Choose gtk-runtime-3.8.1-x86_64.exe
4) Download libgcc_s_seh-1.dll and libwinpthread-1.dll from this site:
https://drive.google.com/file/d/1JVli4y ... sp=sharing (I find this files from internet).
And unzip files to folder C:\Program Files\gtk-3.8.1\
5) Save GtkBuilder_Cairo.bas to folder C:\Program Files\gtk-3.8.1\, so that the program finds the gtk3 64-bit library dlls.

It compiles and runs.
TJF
Posts: 3604
Joined: Dec 06, 2009 22:27
Location: N47°, E15°
Contact:

Re: gtk +xml tutorial why not work?

Postby TJF » May 11, 2020 11:35

Note: this is an important hint:
Xusinboy Bekchanov wrote:Use Geany for IDE: https://www.geany.org/download/releases/.
Gtk is well prepared for I18N and uses UTF-8 character encoding for all string context. AFAIK FbIde doesn't support that encoding. Switching to Geany is a must have.
systemctl
Posts: 182
Joined: Mar 27, 2020 5:15

Re: gtk +xml tutorial why not work?

Postby systemctl » May 11, 2020 15:11

TJF wrote:Note: this is an important hint:
Xusinboy Bekchanov wrote:Use Geany for IDE: https://www.geany.org/download/releases/.
Gtk is well prepared for I18N and uses UTF-8 character encoding for all string context. AFAIK FbIde doesn't support that encoding. Switching to Geany is a must have.


Many of the IUP based IDEs on this forum also worked fine for this. So Geany is not a must.
Xusinboy Bekchanov
Posts: 254
Joined: Jul 26, 2018 18:28

Re: gtk +xml tutorial why not work?

Postby Xusinboy Bekchanov » May 15, 2020 23:36

It turns out that you do not need to download runtime separately.
Lib compatible dll files located in folders \msys2\msys32\mingw32\bin and \msys2\msys32\mingw64\bin

These dlls need to be copied to the newly-compiled exe folder

gtk3 32-bit dlls
https://drive.google.com/file/d/1Cybpf- ... sp=sharing

gtk3 64-bit dlls
https://drive.google.com/file/d/10lSg6r ... sp=sharing
Makoto WATANABE
Posts: 196
Joined: Apr 10, 2010 11:41
Location: Japan
Contact:

Re: gtk +xml tutorial why not work?

Postby Makoto WATANABE » Jul 10, 2020 11:12

Dear Xusinboy Bekchanov;

Thank you for telling me the URL where I can download the required runtime all together.
I was able to compile and run the FreeBASIC "GTK+" and "glib" sample programs by useing the "gtk3 32-bit dlls" and adding some of dlls I had.
C:\Tool\FreeBASIC\examples\GUI\GTK+\
C:\Tool\FreeBASIC\examples\misc\glib\
Thank you very much.

My execution environment:
Microsoft Windows [Version 10.0.18363.900]
FreeBASIC Compiler - Version 1.07.1 (2019-09-27), built for win32 (32bit)

P.S.
If anyone knows solutions to the following two points, please let me know.

1. I initially registered dlls in the "C:\Tool\FreeBASIC\lib\win32\" folder, but I couldn't use them to compile.
When I registered dlls in the program source folder, I was able to compile programs.
Is the "FreeBASIC\lib\win32" path not valid?

2. "\examples\misc\glib\g_SplitArguments.bas" could not be compiled with following errors.

C:\Tool\FreeBASIC\\fbc -s console "g_SplitArguments.bas"

g_SplitArguments.bas(61) error 4: Duplicated definition, at parameter 1 (object) of TEST_APPLICATION_FINALIZE() in 'SUB test_application_finalize CDECL(BYVAL object AS GObject PTR)'
g_SplitArguments.bas(62) error 58: Type mismatch, at parameter 1 of sub cdecl(as _GOBJECT ptr) in 'G_OBJECT_CLASS (test_application_parent_class)->finalize(object)'
g_SplitArguments.bas(75) error 42: Variable not declared, __func__ in 'g_return_val_if_fail(g_application_id_is_valid (application_id), NULL)'
TJF
Posts: 3604
Joined: Dec 06, 2009 22:27
Location: N47°, E15°
Contact:

Re: gtk +xml tutorial why not work?

Postby TJF » Jul 10, 2020 12:33

Makoto WATANABE wrote:2. "\examples\misc\glib\g_SplitArguments.bas" could not be compiled with following errors.

C:\Tool\FreeBASIC\\fbc -s console "g_SplitArguments.bas"

g_SplitArguments.bas(61) error 4: Duplicated definition, at parameter 1 (object) of TEST_APPLICATION_FINALIZE() in 'SUB test_application_finalize CDECL(BYVAL object AS GObject PTR)'
g_SplitArguments.bas(62) error 58: Type mismatch, at parameter 1 of sub cdecl(as _GOBJECT ptr) in 'G_OBJECT_CLASS (test_application_parent_class)->finalize(object)'
g_SplitArguments.bas(75) error 42: Variable not declared, __func__ in 'g_return_val_if_fail(g_application_id_is_valid (application_id), NULL)'
This example is from 2011. Meanwhile the symbol Object is a keyword in FB. Fix it by

Code: Select all

SUB test_application_finalize CDECL(BYVAL Obj AS GObject PTR)
  G_OBJECT_CLASS (test_application_parent_class)->finalize(Obj)
END SUB

The second error is related to a translation error in the original FB headers in line #DEFINE g_return_val_if_fail. You can use gir_headers instead:

Code: Select all

'#INCLUDE ONCE "gio/gio.bi"
#INCLUDE ONCE "Gir/Gio-2.0.bi"
#INCLUDE ONCE "Gir/_GLibMacros-2.0.bi"
#INCLUDE ONCE "Gir/_GObjectMacros-2.0.bi"

Regards

Return to “Beginners”

Who is online

Users browsing this forum: No registered users and 2 guests