Preview/Printing problem lazarus / 21-General ---------------------------------------------------------------------- Neville · 2021-03-14 16:29 I have a unit/form which enables me to preview print data and optionally print it.  It works well for me, but whenever I attempt to add it into a new project, I get the following error:     Fatal: Unit PrintersDlgs searched but Printers found I have found by trial and error that if I remove the component TPrintDialog from the unit, and then replace it, patching up the code, then everything compiles OK.  What could be causing this problem?  Should I report it as a bug? I'm attaching the code. ---------------------------------------------------------------------- wp · 2021-03-14 16:53 Does your project contain a requirement for the package "Printer4Lazarus"? Open the "Project Inspector" (menu Project); the treeview should list "Printer4Lazarus" under "Required Packages". If not, then right-click on "Required Packages" > "Add" and type "Printer4Lazarus" in the edit box. > OK. Then try to compile your project again. Unlike Delphi, the default LCL does not contain printer support. For printing you always must add the "Printer4Lazarus" package. ---------------------------------------------------------------------- jamie · 2021-03-14 18:53 Quote from: Neville on March 14, 2021, 05:29:53 pmI have a unit/form which enables me to preview print data and optionally print it.  It works well for me, but whenever I attempt to add it into a new project, I get the following error:     Fatal: Unit PrintersDlgs searched but Printers found I have found by trial and error that if I remove the component TPrintDialog from the unit, and then replace it, patching up the code, then everything compiles OK.  What could be causing this problem?  Should I report it as a bug? I'm attaching the code. That is a compiler bug, I reported such behavior before but all I got was flack and a lot of theories. As far as I know it never went anywhere.. The problem is when a file name reaches 8 letters exactly and the search happens to find a file name with the first 8 letters that match and thus stops and gives that report. Got luck in getting it fixed... I suppose you could some how change the file name in the first 8 so it won't match anything obvious. ---------------------------------------------------------------------- wp · 2021-03-14 21:37 Quote from: jamie on March 14, 2021, 07:53:42 pmThat is a compiler bug, I reported such behavior before but all I got was flack and a lot of theories. [...] The problem is when a file name reaches 8 letters exactly and the search happens to find a file name with the first 8 letters that match and thus stops and gives that report. I have no idea what you are talking about. Which 8 letters? I added Neville's unit to a dummy project, and I got the reported error at first. Then I added Printer4Lazarus to the project's requirements as I explained above, and everything was fine. ---------------------------------------------------------------------- jamie · 2021-03-14 21:54 yes, there is a search problem involving 8 characters in the file name matching another one. It gives an ambiguous error if it does not find the unit its searching for but instead reports finding another unit that has the first 8 letters that match the search..    I am not going to bother to dig up the thread on it, its hear somewhere in forum land..