FLTK headers for FreeBasic OOP (no C wrapper)
Re: FLTK headers for FreeBasic OOP (no C wrapper)
I think the bug is in Poseidon. Try compiling from the command line
-
- Posts: 237
- Joined: Jul 15, 2021 7:23
- Location: Greece
- Contact:
Re: FLTK headers for FreeBasic OOP (no C wrapper)
i did.... i copy the Rebuild command and i got errors from terminal
but the exec file is created and running correctlyuser@laptop:~/Documents/Workspaces/freebasic/FLTK/fltk109$ /home/user/Bin/FreeBASIC/FreeBASIC-1.10.0-source/bin/fbc -x "fltk109" -m "main" -b "main.bas" -i "/home/user/Bin/FreeBASIC/FreeBASIC-1.10.0-linux-x86_64/include/freebasic" -p "/home/user/Bin/FreeBASIC/FreeBASIC-1.10.0-linux-x86_64/lib/freebasic/linux-x86_64" -l Xrender -l Xcursor -l Xfixes -l Xext -l Xft -l fontconfig -l Xinerama -l pthread -l m -l X11 -l png -l z -l jpeg
main.c: In function ‘_ZN9Fl_Window14force_positionEv’:
main.c:427:14: warning: infinite recursion detected [-Winfinite-recursion]
427 | static int32 _ZN9Fl_Window14force_positionEv( struct $9Fl_Window* THIS$1 )
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
main.c:434:22: note: recursive call
434 | int32 vr$3 = _ZN9Fl_Window14force_positionEv( THIS$1 );
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
user@laptop:~/Documents/Workspaces/freebasic/FLTK/fltk109$
user@laptop:~/Documents/Workspaces/freebasic/FLTK/fltk109$ ls -la
total 432
drwxr-xr-x 2 user user 4096 Aug 7 03:16 .
drwxr-xr-x 5 user user 4096 Aug 7 01:19 ..
-rw-r--r-- 1 user user 563 Aug 7 02:49 FB.poseidon
-rwxr-xr-x 1 user user 425400 Aug 7 03:16 fltk109
-rw-r--r-- 1 user user 229 Aug 7 01:34 main.bas
-
- Posts: 237
- Joined: Jul 15, 2021 7:23
- Location: Greece
- Contact:
Re: FLTK headers for FreeBasic OOP (no C wrapper)
i also tried the libs*.a from mediafire .... still get the same error
---------------------------------------------------------------------------------------------
one question...does it mater the gcc version ?
i have Debian 13.2.0 version of gcc
---------------------------------------------------------------------------------------------
one question...does it mater the gcc version ?
i have Debian 13.2.0 version of gcc
but i think it is not that....it is on creation of .c fileUsing built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-linux-gnu/13/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 13.2.0-1' --with-bugurl=file:///usr/share/doc/gcc-13/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-13 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/libexec --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/reproducible-path/gcc-13-13.2.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/reproducible-path/gcc-13-13.2.0/debian/tmp-gcn/usr --enable-offload-defaulted --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-serialization=2
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 13.2.0 (Debian 13.2.0-1)
Re: FLTK headers for FreeBasic OOP (no C wrapper)
I checked in the .c file, indeed there is an infinite recursion (although it's in a function that is not called). It happens due to a mistake I have made in the header, but the fix I suggested you should have removed it. So I suspected the editor had created a copy of the old header somewhere
-
- Posts: 237
- Joined: Jul 15, 2021 7:23
- Location: Greece
- Contact:
Re: FLTK headers for FreeBasic OOP (no C wrapper)
it is not the editor...angros47 wrote: ↑Aug 07, 2023 9:38 I checked in the .c file, indeed there is an infinite recursion (although it's in a function that is not called). It happens due to a mistake I have made in the header, but the fix I suggested you should have removed it. So I suspected the editor had created a copy of the old header somewhere
i tried from terminal...also still i get the error
-
- Posts: 237
- Joined: Jul 15, 2021 7:23
- Location: Greece
- Contact:
Re: FLTK headers for FreeBasic OOP (no C wrapper)
well i made a test........ i created a new Project FLTK109_2 with the same main.bas...demosthenesk wrote: ↑Aug 07, 2023 9:49it is not the editor...angros47 wrote: ↑Aug 07, 2023 9:38 I checked in the .c file, indeed there is an infinite recursion (although it's in a function that is not called). It happens due to a mistake I have made in the header, but the fix I suggested you should have removed it. So I suspected the editor had created a copy of the old header somewhere
i tried from terminal...also still i get the error
it compiles without an error...
so you are right it is Poseidon bug somewhere it cached files and use the old ones...
-
- Posts: 237
- Joined: Jul 15, 2021 7:23
- Location: Greece
- Contact:
Re: FLTK headers for FreeBasic OOP (no C wrapper)
Also i did something else...
in Project FLTK109 which produces the error,
i renamed main.bas to main2.bas and it compiled ok!
t rename again main2.bas back to main.bas and now it compiled this also ok!
in Project FLTK109 which produces the error,
i renamed main.bas to main2.bas and it compiled ok!
t rename again main2.bas back to main.bas and now it compiled this also ok!
-
- Posts: 237
- Joined: Jul 15, 2021 7:23
- Location: Greece
- Contact:
Re: FLTK headers for FreeBasic OOP (no C wrapper)
Example code in Debian 13 Trixie (testing), it works fine, no errors, run successfully
Example1
Example2 equivalent with Example1
Example1
Code: Select all
#include "FLTK_main/Fl_Window.bi"
#include "FLTK_main/Fl_Box.bi"
Dim As ZString * 13 str1 => "hello, world"
Dim fWindow as Fl_Window = Fl_Window(0, 0, 340, 180, str1)
Dim fBox as Fl_Box = Fl_Box(20, 40, 300, 100, str1)
fBox.box(FL_UP_BOX)
fBox.labelfont(FL_BOLD + FL_ITALIC)
fBox.labelsize(36)
fBox.labeltype(FL_SHADOW_LABEL)
fWindow.end_()
fWindow.show
Fl.run_()
Code: Select all
#include "FLTK_main/Fl_Window.bi"
#include "FLTK_main/Fl_Box.bi"
Dim fWindow As Fl_Window Ptr
Dim fBox As Fl_Box Ptr
Dim As ZString * 13 str1 => "hello, world"
fWindow = New Fl_Window(0, 0, 340, 180, str1)
fBox = New Fl_Box(20, 40, 300, 100, str1)
fBox->box(FL_UP_BOX)
fBox->labelfont(FL_BOLD + FL_ITALIC)
fBox->labelsize(36)
fBox->labeltype(FL_SHADOW_LABEL)
fWindow->end_()
fWindow->show()
Fl.run_()
Re: FLTK headers for FreeBasic OOP (no C wrapper)
I am glad it worked!
I added the change to the repository on github, thank you for discovering that bug
I added the change to the repository on github, thank you for discovering that bug
Re: FLTK headers for FreeBasic OOP (no C wrapper)
Dear all:
I'm sorry that poseidon's output message is not so accurate, I'll try to modify it.
At the present stage, if we compile with -v option, poseidon always told us compile fail, because poseidon check stdout and stderr message, if stdout with message and line data without "(" and ") warning" strings, poseidon will treat compile error, I'll modify to get process status to check
I'm sorry that poseidon's output message is not so accurate, I'll try to modify it.
At the present stage, if we compile with -v option, poseidon always told us compile fail, because poseidon check stdout and stderr message, if stdout with message and line data without "(" and ") warning" strings, poseidon will treat compile error, I'll modify to get process status to check
-
- Posts: 237
- Joined: Jul 15, 2021 7:23
- Location: Greece
- Contact:
Re: FLTK headers for FreeBasic OOP (no C wrapper)
HOW TO COMPILE AND RUN FLTK APPS IN WIN11
Hello,
i manage to compile and run the FLTK example in Win11 and i want to share the proccess with you.
1 ) First you have to install Msys2 (https://www.msys2.org/)
2 ) install for Msys2 MINGW64 the mingw-w64-x86_64-fltk package (https://packages.msys2.org/package/ming ... po=mingw64)
3 ) Copy fltk libs to Freebasic lib\win64 folder (FreeBASIC-1.10.0-win64\lib\win64)
C:\msys64\mingw64\bin\libfltk.dll
C:\msys64\mingw64\bin\libfltk_forms.dll
C:\msys64\mingw64\bin\libfltk_gl.dll
C:\msys64\mingw64\bin\libfltk_images.dll
C:\msys64\mingw64\lib\libfltk.dll.a
C:\msys64\mingw64\lib\libfltk_forms.dll.a
C:\msys64\mingw64\lib\libfltk_gl.dll.a
C:\msys64\mingw64\lib\libfltk_images.dll.a
4 ) Create in your favorite freebasic ide (My is Poseidon) the fltk project
5 ) Add to your project properties the include and lib\win64 folders path
6 ) Download the FLTK angros47 headers from github (https://github.com/angros47/FLTK-headers-for-FreeBasic)
7 ) unzip angros47 FLTK headers to Freebasic include folder in a folder named FLTK
8 ) copy the next files from Msys2 installation folder, mine is C:\msys64\mingw64\bin to your Freebasic Project folder
C:\msys64\mingw64\bin\libfltk.dll
C:\msys64\mingw64\bin\libfltk_forms.dll
C:\msys64\mingw64\bin\libfltk_gl.dll
C:\msys64\mingw64\bin\libfltk_images.dll
C:\msys64\mingw64\lib\libfltk.dll.a
C:\msys64\mingw64\lib\libfltk_forms.dll.a
C:\msys64\mingw64\lib\libfltk_gl.dll.a
C:\msys64\mingw64\lib\libfltk_images.dll.a
C:\msys64\mingw64\bin\libgcc_s_seh-1.dll
C:\msys64\mingw64\bin\libstdc++-6.dll
C:\msys64\mingw64\bin\libwinpthread-1.dll
9) write an example main.bas file
10) Build project
11) Run project
You should have successfully run your first FLTK app in Win11
Hello,
i manage to compile and run the FLTK example in Win11 and i want to share the proccess with you.
1 ) First you have to install Msys2 (https://www.msys2.org/)
2 ) install for Msys2 MINGW64 the mingw-w64-x86_64-fltk package (https://packages.msys2.org/package/ming ... po=mingw64)
3 ) Copy fltk libs to Freebasic lib\win64 folder (FreeBASIC-1.10.0-win64\lib\win64)
C:\msys64\mingw64\bin\libfltk.dll
C:\msys64\mingw64\bin\libfltk_forms.dll
C:\msys64\mingw64\bin\libfltk_gl.dll
C:\msys64\mingw64\bin\libfltk_images.dll
C:\msys64\mingw64\lib\libfltk.dll.a
C:\msys64\mingw64\lib\libfltk_forms.dll.a
C:\msys64\mingw64\lib\libfltk_gl.dll.a
C:\msys64\mingw64\lib\libfltk_images.dll.a
4 ) Create in your favorite freebasic ide (My is Poseidon) the fltk project
5 ) Add to your project properties the include and lib\win64 folders path
6 ) Download the FLTK angros47 headers from github (https://github.com/angros47/FLTK-headers-for-FreeBasic)
7 ) unzip angros47 FLTK headers to Freebasic include folder in a folder named FLTK
8 ) copy the next files from Msys2 installation folder, mine is C:\msys64\mingw64\bin to your Freebasic Project folder
C:\msys64\mingw64\bin\libfltk.dll
C:\msys64\mingw64\bin\libfltk_forms.dll
C:\msys64\mingw64\bin\libfltk_gl.dll
C:\msys64\mingw64\bin\libfltk_images.dll
C:\msys64\mingw64\lib\libfltk.dll.a
C:\msys64\mingw64\lib\libfltk_forms.dll.a
C:\msys64\mingw64\lib\libfltk_gl.dll.a
C:\msys64\mingw64\lib\libfltk_images.dll.a
C:\msys64\mingw64\bin\libgcc_s_seh-1.dll
C:\msys64\mingw64\bin\libstdc++-6.dll
C:\msys64\mingw64\bin\libwinpthread-1.dll
9) write an example main.bas file
Code: Select all
#include once "FLTK/Fl_Window.bi"
#include once "FLTK/Fl_Button.bi"
dim w as Fl_Window = Fl_Window(940,380,"Window")
dim b as Fl_button = Fl_button(10,30,150,30,"This is a button")
w.end_()
w.show
fl.run_
11) Run project
You should have successfully run your first FLTK app in Win11
Re: FLTK headers for FreeBasic OOP (no C wrapper)
Nicely done!
Out of curiosity, have you managed to compile the library for static linking, too, under windows?
Meanwhile, here is another converted example:
Out of curiosity, have you managed to compile the library for static linking, too, under windows?
Meanwhile, here is another converted example:
Code: Select all
'
' "$Id$"
'
' A simple example of Fl_Text_Editor
'
' Fl_Text_Editor is unlike other FLTK widgets in that
' to work correctly, it must be assigned to an instance of an
' Fl_Text_Buffer. The below shows using buffer() to connect
' the two classes together.
'
' Note that the example can also be used to demonstrate
' Fl_Text_Display; just replace all instances of
' Fl_Text_Editor with Fl_Text_Display and rebuild.
'
' Copyright 2010 Greg Ercolano.
' Copyright 1998-2010 by Bill Spitzak and others.
'
' This library is free software. Distribution and use rights are outlined in
' the file "COPYING" which should have been included with this file. If this
' file is missing or damaged, see the license at:
'
' http:'www.fltk.org/COPYING.php
'
' Please report all bugs and problems on the following page:
'
' http:'www.fltk.org/str.php
'
#include once "FLTK/Fl.bi"
#include once "FLTK/Fl_Double_Window.bi"
#include once "FLTK/Fl_Text_Editor.bi"
dim win as Fl_Double_Window ptr = new Fl_Double_Window(640, 480, "Simple Fl_Text_Editor")
dim buff as Fl_Text_Buffer ptr = new Fl_Text_Buffer()
dim edit as Fl_Text_Editor ptr = new Fl_Text_Editor(20, 20, 640-40, 480-40)
edit->buffer(buff) ' attach the text buffer to our editor widget
win->resizable(*edit)
win->show()
buff->text(!"line 0\nline 1\nline 2\n"+_
!"line 3\nline 4\nline 5\n"+_
!"line 6\nline 7\nline 8\n"+_
!"line 9\nline 10\nline 11\n"+_
!"line 12\nline 13\nline 14\n"+_
!"line 15\nline 16\nline 17\n"+_
!"line 18\nline 19\nline 20\n"+_
!"line 21\nline 22\nline 23\n")
Fl.run_()
'
' End of "$Id$".
'
-
- Posts: 237
- Joined: Jul 15, 2021 7:23
- Location: Greece
- Contact:
Re: FLTK headers for FreeBasic OOP (no C wrapper)
I say to try compile FLTK under mingw32 on Msys2 because there is no Msys2 package for x32.
So far i just copy the files of Msys2. I have not try to compile the FLTK...so far...but i will try tomorrow
i found this (Building FLTK 1.3.3 with MSYS/MinGW on Windows 8.1) https://bmatthew1.altervista.org/building.fltk.html
So far i just copy the files of Msys2. I have not try to compile the FLTK...so far...but i will try tomorrow
i found this (Building FLTK 1.3.3 with MSYS/MinGW on Windows 8.1) https://bmatthew1.altervista.org/building.fltk.html
angros47 wrote: ↑Aug 08, 2023 21:52 Nicely done!
Out of curiosity, have you managed to compile the library for static linking, too, under windows?
Meanwhile, here is another converted example:Code: Select all
' ' "$Id$" ' ' A simple example of Fl_Text_Editor ' ' Fl_Text_Editor is unlike other FLTK widgets in that ' to work correctly, it must be assigned to an instance of an ' Fl_Text_Buffer. The below shows using buffer() to connect ' the two classes together. ' ' Note that the example can also be used to demonstrate ' Fl_Text_Display; just replace all instances of ' Fl_Text_Editor with Fl_Text_Display and rebuild. ' ' Copyright 2010 Greg Ercolano. ' Copyright 1998-2010 by Bill Spitzak and others. ' ' This library is free software. Distribution and use rights are outlined in ' the file "COPYING" which should have been included with this file. If this ' file is missing or damaged, see the license at: ' ' http:'www.fltk.org/COPYING.php ' ' Please report all bugs and problems on the following page: ' ' http:'www.fltk.org/str.php ' #include once "FLTK/Fl.bi" #include once "FLTK/Fl_Double_Window.bi" #include once "FLTK/Fl_Text_Editor.bi" dim win as Fl_Double_Window ptr = new Fl_Double_Window(640, 480, "Simple Fl_Text_Editor") dim buff as Fl_Text_Buffer ptr = new Fl_Text_Buffer() dim edit as Fl_Text_Editor ptr = new Fl_Text_Editor(20, 20, 640-40, 480-40) edit->buffer(buff) ' attach the text buffer to our editor widget win->resizable(*edit) win->show() buff->text(!"line 0\nline 1\nline 2\n"+_ !"line 3\nline 4\nline 5\n"+_ !"line 6\nline 7\nline 8\n"+_ !"line 9\nline 10\nline 11\n"+_ !"line 12\nline 13\nline 14\n"+_ !"line 15\nline 16\nline 17\n"+_ !"line 18\nline 19\nline 20\n"+_ !"line 21\nline 22\nline 23\n") Fl.run_() ' ' End of "$Id$". '
-
- Posts: 237
- Joined: Jul 15, 2021 7:23
- Location: Greece
- Contact:
Re: FLTK headers for FreeBasic OOP (no C wrapper)
My mistake, there is fltk msys2 package for win32 it is this (https://packages.msys2.org/package/ming ... po=mingw32)
HOW TO COMPILE AND RUN FLTK APPS IN WIN32
i manage to compile and run the FLTK example in Win32 fbc and i want to share the proccess with you.
1 ) First you have to install Msys2 (https://www.msys2.org/)
2 ) install for Msys2 MINGW32 the mingw-w64-i686-fltk package (https://packages.msys2.org/package/ming ... po=mingw32)
3 ) Copy fltk libs to Freebasic lib\win32 folder (FreeBASIC-1.10.0-win32\lib\win32)
C:\msys64\mingw32\bin\libfltk.dll
C:\msys64\mingw32\bin\libfltk_forms.dll
C:\msys64\mingw32\bin\libfltk_gl.dll
C:\msys64\mingw32\bin\libfltk_images.dll
C:\msys64\mingw32\lib\libfltk.dll.a
C:\msys64\mingw32\lib\libfltk_forms.dll.a
C:\msys64\mingw32\lib\libfltk_gl.dll.a
C:\msys64\mingw32\lib\libfltk_images.dll.a
4 ) Create in your favorite freebasic ide (My is Poseidon) the fltk project
5 ) Add to your project properties the include and lib\win32 folders path
6 ) Download the FLTK angros47 headers from github (https://github.com/angros47/FLTK-headers-for-FreeBasic)
7 ) unzip angros47 FLTK headers to Freebasic include folder in a folder named FLTK
8 ) copy the next files from Msys2 installation folder, mine is C:\msys64\mingw32\bin to your Freebasic Project folder
C:\msys64\mingw32\bin\libfltk.dll
C:\msys64\mingw32\bin\libfltk_forms.dll
C:\msys64\mingw32\bin\libfltk_gl.dll
C:\msys64\mingw32\bin\libfltk_images.dll
C:\msys64\mingw32\lib\libfltk.dll.a
C:\msys64\mingw32\lib\libfltk_forms.dll.a
C:\msys64\mingw32\lib\libfltk_gl.dll.a
C:\msys64\mingw32\lib\libfltk_images.dll.a
C:\msys64\mingw32\bin\libgcc_s_dw2-1.dll
C:\msys64\mingw32\bin\libstdc++-6.dll
C:\msys64\mingw32\bin\libwinpthread-1.dll
9) write an example main.bas file
10) Build project
11) Run project
You should have successfully run your first FLTK app in Win11 for fbc32
HOW TO COMPILE AND RUN FLTK APPS IN WIN32
i manage to compile and run the FLTK example in Win32 fbc and i want to share the proccess with you.
1 ) First you have to install Msys2 (https://www.msys2.org/)
2 ) install for Msys2 MINGW32 the mingw-w64-i686-fltk package (https://packages.msys2.org/package/ming ... po=mingw32)
3 ) Copy fltk libs to Freebasic lib\win32 folder (FreeBASIC-1.10.0-win32\lib\win32)
C:\msys64\mingw32\bin\libfltk.dll
C:\msys64\mingw32\bin\libfltk_forms.dll
C:\msys64\mingw32\bin\libfltk_gl.dll
C:\msys64\mingw32\bin\libfltk_images.dll
C:\msys64\mingw32\lib\libfltk.dll.a
C:\msys64\mingw32\lib\libfltk_forms.dll.a
C:\msys64\mingw32\lib\libfltk_gl.dll.a
C:\msys64\mingw32\lib\libfltk_images.dll.a
4 ) Create in your favorite freebasic ide (My is Poseidon) the fltk project
5 ) Add to your project properties the include and lib\win32 folders path
6 ) Download the FLTK angros47 headers from github (https://github.com/angros47/FLTK-headers-for-FreeBasic)
7 ) unzip angros47 FLTK headers to Freebasic include folder in a folder named FLTK
8 ) copy the next files from Msys2 installation folder, mine is C:\msys64\mingw32\bin to your Freebasic Project folder
C:\msys64\mingw32\bin\libfltk.dll
C:\msys64\mingw32\bin\libfltk_forms.dll
C:\msys64\mingw32\bin\libfltk_gl.dll
C:\msys64\mingw32\bin\libfltk_images.dll
C:\msys64\mingw32\lib\libfltk.dll.a
C:\msys64\mingw32\lib\libfltk_forms.dll.a
C:\msys64\mingw32\lib\libfltk_gl.dll.a
C:\msys64\mingw32\lib\libfltk_images.dll.a
C:\msys64\mingw32\bin\libgcc_s_dw2-1.dll
C:\msys64\mingw32\bin\libstdc++-6.dll
C:\msys64\mingw32\bin\libwinpthread-1.dll
9) write an example main.bas file
Code: Select all
#include once "FLTK/Fl_Window.bi"
#include once "FLTK/Fl_Button.bi"
dim w as Fl_Window = Fl_Window(940,380,"Window")
dim b as Fl_button = Fl_button(10,30,150,30,"This is a button")
w.end_()
w.show
fl.run_
11) Run project
You should have successfully run your first FLTK app in Win11 for fbc32
-
- Posts: 237
- Joined: Jul 15, 2021 7:23
- Location: Greece
- Contact:
Re: FLTK headers for FreeBasic OOP (no C wrapper)
i tried to compile FLTK static for mingw32 but the make file fails at fluid compilation...
but dont worry Msys2 has i686 fltk package for win32... see previous post...
but dont worry Msys2 has i686 fltk package for win32... see previous post...