Lazarus

Programming => General => Topic started by: tintinux on November 16, 2019, 10:44:47 am

Title: using packages in console application
Post by: tintinux on November 16, 2019, 10:44:47 am
Hi

I create an empty console application and if I add to the project the requirement for some third party packages (e.g zcomponent from ZeosLib, or pack_powerpdf, or others), it compiles but ends with "Error: Error while linking".

Of course, I have no problem with these packages in a normal Application using Forms and LCL.

I guess that those packages are containing or referring somethings not suitable for console applications. However, even with packages containing no register functions and no references to UI stuff, I get the issue.

So, my question is how I can discover what is wrong in this packages.

Thanks for hints
Title: Re: using packages in console application
Post by: howardpc on November 16, 2019, 11:19:36 am
Right-click on the message in the Messages window and choose Copy->Copy All/Original Messages to Clipboard
This gives you a complete (unfiltered) list of messages to inspect.
Often you will then discover which specific library/libraries is/are not found at the linking stage, etc.
Title: Re: using packages in console application
Post by: wp on November 16, 2019, 11:44:11 am
Open the package in the IDE ("Package" > "Open package file (*.lpk)"). When you see "LCL" among the "Required packages" you usually are out of luck in a console program. Sometimes libraries are split into sub-packages. The main fpspreadsheet package (laz_fpspreadsheet) does not require LCL while laz_fpspreadsheet_visual does.

- ZEOS: zcore.lpk requires LCL  :(
- powerpdf:  pack_powerpdf.lpk requires LCL :(

For pdf generation you could try fcl-pdf which comes with the fpc installation (included in fcl).
Title: Re: using packages in console application
Post by: tintinux on November 21, 2019, 05:45:08 pm
Quote from: wp
you could try fcl-pdf

Do you know if fcl-pdf can be used by lazreport ?
Or by another report generator, although I would not be happy to make again a number of reports...

Thanks