Author Topic: using packages in console application  (Read 91 times)


  • Sr. Member
  • ****
  • Posts: 303
    • Gestinux
using packages in console application
« on: November 16, 2019, 10:44:47 am »

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
Initiator of gestinux, open-source, multi-database and multilingual accounting and billing software made with LAZARUS.

You can help to develop, to make and improve translations, and to provide examples of legal charts and reports from more countries.


  • Hero Member
  • *****
  • Posts: 3178
Re: using packages in console application
« Reply #1 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.


  • Hero Member
  • *****
  • Posts: 6334
Re: using packages in console application
« Reply #2 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).
Lazarus trunk / fpc 3.0.4 / all 32-bit on Win-10