Recent

Author Topic: Cannot compile fpde: Illegal type conversion  (Read 844 times)

Roland57

  • Full Member
  • ***
  • Posts: 187
Cannot compile fpde: Illegal type conversion
« on: April 13, 2021, 07:52:57 am »
Hello!

I would like to compile fpde (fpc/utils/fpdoc/fpde) on Linux 64, with FPC 3.2.0.

I get this error:

frmmain.pp(152,66) Error: Illegal type conversion: "TTagType" to "Pointer"
frmmain.pp(158,72) Error: Illegal type conversion: "TTagType" to "Pointer"
frmmain.pp(711,11) Error: Illegal type conversion: "Pointer" to "TNodeType"
frmmain.pp(748,27) Error: Illegal type conversion: "Pointer" to "TTagType"


Would someone know how to fix it?

Regards.

Roland

Roland57

  • Full Member
  • ***
  • Posts: 187
Re: Cannot compile fpde: Illegal type conversion
« Reply #1 on: April 13, 2021, 09:09:36 am »
I believe I found the solution.

Code: Pascal  [Select][+][-]
  1. Function TMainForm.FormatMenuItem(ACaption : String; tt : TTagType) : TFPgtkMenuItem;
  2.  
  3. begin
  4.   //Result:=NewMenuItem(ACaption,FormatHint(ACaption),'',@TagClick,Pointer(tt));
  5.   Result:=NewMenuItem(ACaption,FormatHint(ACaption),'',@TagClick,@tt);

Code: Pascal  [Select][+][-]
  1. Procedure TMainForm.TagClick(Sender : TFPGtkObject; Data : Pointer);
  2.  
  3. begin
  4.   //CurrentEditor.InsertTag(TTagType(Data));
  5.   CurrentEditor.InsertTag(TTagType(Data^));

Now I get this:

Linking ./fpde
/usr/bin/ld : ne peut trouver -lgtk
fpde.pp(13,1) Error: Error while linking


but this is another story.  :)

Roland57

  • Full Member
  • ***
  • Posts: 187
Re: Cannot compile fpde: Illegal type conversion
« Reply #2 on: April 13, 2021, 09:20:59 am »
Would it be much work to port the application from GTK to GTK2?

Would you know where I can find an example of a GTK2 application?
« Last Edit: April 13, 2021, 09:37:10 am by Roland57 »

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 9336
  • FPC developer.
Re: Cannot compile fpde: Illegal type conversion
« Reply #3 on: April 13, 2021, 09:24:11 am »
Lazarus generates GTK2 applications. But since Lazarus acquired a win32 backend in the 2003-2005, (any) GTK on Windows has been rare.


Roland57

  • Full Member
  • ***
  • Posts: 187
Re: Cannot compile fpde: Illegal type conversion
« Reply #4 on: April 13, 2021, 09:39:50 am »
Lazarus generates GTK2 applications. But since Lazarus acquired a win32 backend in the 2003-2005, (any) GTK on Windows has been rare.

Thank you for your answer, but I don't really understand.  :-[

I was wondering if it were possible to do a simple modification to fpde source, so I can compile and link it on my computer (where there is GTK2, but no GTK)?

Fred vS

  • Hero Member
  • *****
  • Posts: 2221
    • StrumPract is the musicians best friend
Re: Cannot compile fpde: Illegal type conversion
« Reply #5 on: April 13, 2021, 11:54:36 am »
I would like to compile fpde (fpc/utils/fpdoc/fpde) on Linux 64, with FPC 3.2.0.

Hello Roland.

Where did you find /fpc/utils/fpdoc/fpde ?
Here on source of fpc 3.2.0 and 3.2.2 I dont find it.

Also, if it exists and if it is in directory /fpc/utils, it should not need GTK (IMHO GTK is a LCL-Lazarus thing).

Fre;D
I use Lazarus 2.0.6 32/64 and FPC 3.2.0 32/64 on Debian 10.2 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64 and Mac OS X Snow Leopard 32.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt, Carbon.

https://github.com/fredvs
https://gitlab.com/fredvs

Roland57

  • Full Member
  • ***
  • Posts: 187
Re: Cannot compile fpde: Illegal type conversion
« Reply #6 on: April 13, 2021, 12:02:13 pm »
Where did you find /fpc/utils/fpdoc/fpde ?
Here on source of fpc 3.2.0 and 3.2.2 I dont find it.

In the directory of a Lazarus  version installed with fpcupdeluxe.

.
Also, if it exists and if it is in directory /fpc/utils, it should not need GTK (IMHO GTK is a LCL-Lazarus thing).

It's a plain Free Pascal program, and it uses GTK.  :)

Code: Pascal  [Select][+][-]
  1. unit frmmain;
  2.  
  3. interface
  4.  
  5. uses
  6.   gtk,gdk,fpgtk,fpgtkext,pgEditor,frmlink,sysutils,classes,fpdeopts;

lucamar

  • Hero Member
  • *****
  • Posts: 4015
Re: Cannot compile fpde: Illegal type conversion
« Reply #7 on: April 13, 2021, 12:10:28 pm »
Where did you find /fpc/utils/fpdoc/fpde ?
Here on source of fpc 3.2.0 and 3.2.2 I dont find it.

In this computer, for example, it's on:
/usr/share/fpcsrc/3.2.0/utils/fpdoc/fpde/

Quote
Also, if it exists and if it is in directory /fpc/utils, it should not need GTK (IMHO GTK is a LCL-Lazarus thing).

The problem is that it is a GTK program but instead of the LCL it uses the low level GTK bindings:
Code: Pascal  [Select][+][-]
  1. program fpde;
  2. {$mode objfpc}
  3. {$H+}
  4. { $apptype gui}
  5.  
  6. uses fpgtk,fpglib,fpgtkext,frmmain,pgeditor;
  7.  
  8. begin
  9.   application := TFPgtkApplication.Create;
  10.   application.MainWindow := TMainForm.Create;
  11.   application.Run;
  12.   application.Free;
  13. end.
Code: Pascal  [Select][+][-]
  1. {$mode objfpc}
  2. {$h+}
  3. unit frmmain;
  4.  
  5. interface
  6.  
  7. uses
  8.   gtk,gdk,fpgtk,fpgtkext,pgEditor,frmlink,sysutils,classes,fpdeopts;
  9.  
  10. Const
  11.   DefaultTooltips = True;
  12.   DefaultToolBarStyle = GTK_TOOLBAR_ICONS;
  13.   DefaultToolbarRelief = GTK_RELIEF_NONE;
  14.   SFileTemplate = 'template.xml';
  15.  
  16. Type
  17.   TNodeType = (ntfile,ntPackage,ntModule,ntElement,ntTopic);
  18.  
  19.   TMainForm = Class(TFPGtkWindow)
  20. {... etc ...}
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

Fred vS

  • Hero Member
  • *****
  • Posts: 2221
    • StrumPract is the musicians best friend
Re: Cannot compile fpde: Illegal type conversion
« Reply #8 on: April 13, 2021, 12:12:51 pm »
In the directory of a Lazarus  version installed with fpcupdeluxe.

Ooops, I see it now, fpde is a directory and in this directory is /fpc/utils/fpdoc/fpde/fpde.pp


It's a plain Free Pascal program, and it uses GTK.  :)

Code: Pascal  [Select][+][-]
  1. unit frmmain;
  2.  
  3. interface
  4.  
  5. uses
  6.   gtk,gdk,fpgtk,fpgtkext,pgEditor,frmlink,sysutils,classes,fpdeopts;

Hum, mwouais, maybe, but usually something that uses GTK should be a Lazarus program and not plain pure Free Pascal program.

Fre;D
« Last Edit: April 13, 2021, 12:18:11 pm by Fred vS »
I use Lazarus 2.0.6 32/64 and FPC 3.2.0 32/64 on Debian 10.2 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64 and Mac OS X Snow Leopard 32.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt, Carbon.

https://github.com/fredvs
https://gitlab.com/fredvs

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 9336
  • FPC developer.
Re: Cannot compile fpde: Illegal type conversion
« Reply #9 on: April 13, 2021, 12:16:47 pm »
FPDE uses fpgtk which is a (not related) precursor to fpgui. fpgtk is a simple object oriented wrapper around GTK1.

FPDE itself is a precursor to fpdoc based editors in Lazarus.

Upgrade options are unknown, build status unknown. Wouldn't be surprised if it hasn't been compiled after 2005-2008 period.


Fred vS

  • Hero Member
  • *****
  • Posts: 2221
    • StrumPract is the musicians best friend
Re: Cannot compile fpde: Illegal type conversion
« Reply #10 on: April 13, 2021, 12:17:17 pm »
@ Lucamar: Ooops, perdona for my previous post that says the same as you.

Fre;D
« Last Edit: April 13, 2021, 12:24:58 pm by Fred vS »
I use Lazarus 2.0.6 32/64 and FPC 3.2.0 32/64 on Debian 10.2 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64 and Mac OS X Snow Leopard 32.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt, Carbon.

https://github.com/fredvs
https://gitlab.com/fredvs

lucamar

  • Hero Member
  • *****
  • Posts: 4015
Re: Cannot compile fpde: Illegal type conversion
« Reply #11 on: April 13, 2021, 12:21:48 pm »
@ Lucamar: Ooops, perdona for my previous post that says the same than you.
No problem. Quasi-simultaneous posts are quite normal in web fora :)
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

Roland57

  • Full Member
  • ***
  • Posts: 187
Re: Cannot compile fpde: Illegal type conversion
« Reply #12 on: April 13, 2021, 12:25:32 pm »
FPDE uses fpgtk which is a (not related) precursor to fpgui. fpgtk is a simple object oriented wrapper around GTK1.

FPDE itself is a precursor to fpdoc based editors in Lazarus.

Upgrade options are unknown, build status unknown. Wouldn't be surprised if it hasn't been compiled after 2005-2008 period.

OK, so I will rather try the Lazarus Documentation Editor, or even edit XML in my favourite text editor.  :)

Regards.

Roland

Fred vS

  • Hero Member
  • *****
  • Posts: 2221
    • StrumPract is the musicians best friend
Re: Cannot compile fpde: Illegal type conversion
« Reply #13 on: April 13, 2021, 12:33:40 pm »
FPDE uses fpgtk which is a (not related) precursor to fpgui. fpgtk is a simple object oriented wrapper around GTK1.

FPDE itself is a precursor to fpdoc based editors in Lazarus.

Upgrade options are unknown, build status unknown. Wouldn't be surprised if it hasn't been compiled after 2005-2008 period.

OK, so I will rather try the Lazarus Documentation Editor, or even edit XML in my favourite text editor.  :)

Regards.

Roland

Or you may install GTK1, following this

on a Debian distro, just do:

Code: Pascal  [Select][+][-]
  1. sudo apt-get update
  2. sudo apt-get install glib glib-shlibs gtk+-shlibs gdk-pixbuf gdk-pixbuf-shlibs
I use Lazarus 2.0.6 32/64 and FPC 3.2.0 32/64 on Debian 10.2 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64 and Mac OS X Snow Leopard 32.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt, Carbon.

https://github.com/fredvs
https://gitlab.com/fredvs

Roland57

  • Full Member
  • ***
  • Posts: 187
Re: Cannot compile fpde: Illegal type conversion
« Reply #14 on: April 13, 2021, 01:07:55 pm »
Or you may install GTK1, following this

on a Debian distro, just do:

Good idea. I will try this. But I don't have a Debian distro. I will ask the question to my fellows who use Mageia.

 

TinyPortal © 2005-2018