Lazarus - Indy10 and console application linking error lazarus / 38-Networking and Web Programming ---------------------------------------------------------------------- Kasia · 2020-09-27 16:09 Hi, I have Indy10 components installed in Lazarus and they work very well in graphics programs. The problem is with the console application. I wrote a simple e-mail program. However, there is a problem with linking. Well, to put components into the code, I go to Project-> Project inspector. There I choose Add-> New Requirement. In the search engine, I enter "Indy" and find "Indylaz". I add it to the requirements. Now I can add the appropriate component modules that I would like to use. However, when building the program, I get a poor message: Quoteproject1.lpr(45,1) Error: Error while linking I googled a bit and found a similar problem: https://forum.lazarus.freepascal.org/index.php?topic=39818.0 However, as advised when following the instructions: Quotesudo apt-get install libgl1-mesa-dev I get message in terminal: Quotelibgl1-mesa-dev is already the newest version (20.0.8-0ubuntu1 ~ 20.04.1). libgl1-mesa-dev marked as manually installed. The problem still exists. What am I doing wrong? Thank you! ---------------------------------------------------------------------- Handoko · 2020-09-27 16:32 Hello Kaska1988, Welcome to the forum. Error while linking message only tells us that a require library needed for building the program is missing. But because Indy has nothing to do with OpenGL and libgl* is OpenGL-related libraries, so installing libgl1-mesa-dev won't fix the issue. Maybe you can try to install the others commonly needed libraries (for Linux): https://forum.lazarus.freepascal.org/index.php/topic,41524.msg288242.h tml#msg288242 ---------------------------------------------------------------------- Kasia · 2020-09-28 15:13 Hello, thank you. I've done these installs: Quote from: garlar27 on June 08, 2018, 06:05:30 pmEvery time I have a problem installing on Linux I try to keep a record of what I did. Last time I installed Lazarus (1.8.2) on Ubuntu (16.4) with a non developer profile so I had to install several libraries: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i         Detail of dependencies:              o------------------o ----------------------o              |   MESSAGE        |    INSTALL         |      COMMAND              O==================O============== ========O======================================           o- | -lgtk-x11-2.0    |                      | (Restart if needed)            | -lgdk-x11-2.0    | libgtk2.0-dev        | sudo apt-get install libgtk2.0-dev              o------------------o---------------------- o           o- | -lX11            | libx11-dev           | sudo apt- get install libx11-dev              o------------------o ----------------------o           o- | -lgdk_pixbuf-2.0 |                    |           o- | -lgobject-2.0    |                      |         o- | -lglib-2.0       |                      |           o- | -lgthread-2.0    |                      |           o- | -lgmodule-2.0    | libgdk-pixbuf2.0-dev | sudo apt-get install libgdk-pixbuf2.0-dev              o------------------o----------------------o           o- | -lpango-1.0      |                      |           o- | -lcairo        |                      |           o- | -lpangocairo-1.0 | libpango1.0-dev      | sudo apt-get install libpango1.0-dev            o------------------o----------------------o           o- | -latk-1.0        | libatk1.0-dev        | sudo apt-get install libatk1.0-dev            o------------------o----------------------o              Some Package Dependencies              o------------------o ----------------------o              |   MESSAGE        |    INSTALL         |      COMMAND              O==================O============== ========O======================================           o- | -lGL           | libgl1-mesa-dev      | sudo apt-get install libgl1-mesa- dev              o------------------o----------------------o           o- | -lcl             | libcl.so             | look here http://forum.lazarus.freepascal.org/index.php?topic=28053.15            o------------------o----------------------o I hope it helps But error still appears :/ ---------------------------------------------------------------------- Remy Lebeau · 2020-09-28 18:42 Quote from: Kasia on September 27, 2020, 06:09:22 pmHowever, when building the program, I get a poor message: Quoteproject1.lpr(45,1) Error: Error while linking What is the COMPLETE error message?  Which module(s) is it actually complaining about?  Please be more specific. ---------------------------------------------------------------------- Kasia · 2020-09-29 02:27 Quote from: Remy Lebeau on September 28, 2020, 08:42:34 pmQuote from: Kasia on September 27, 2020, 06:09:22 pmHowever, when building the program, I get a poor message: Quoteproject1.lpr(45,1) Error: Error while linking What is the COMPLETE error message?  Which module(s) is it actually complaining about?  Please be more specific. I would love too, but it is all I get: https://ibb.co/ZcDc9s2 How can I make lazarus be more specific? ---------------------------------------------------------------------- zamronypj · 2020-09-29 19:34 maybe related to this https://forum.lazarus.freepascal.org/index.php?topic=48348.0 ---------------------------------------------------------------------- howardpc · 2020-09-29 19:51 It might not help at all, but you could try adding Interfaces to your uses clause (and perhaps LCL or LCLBase as a required package if it is not already specified). Also, if Indy is threaded (I don't use it so I don't know) on Linux you will need cthreads also in your uses clause. ---------------------------------------------------------------------- BSaidus · 2020-10-02 13:08 Hello. Add interfaces to your uses unit and check the paths inside your fpc.cfg located in the fpc\bin\i386-win32 folder. then proceed . ---------------------------------------------------------------------- Kasia · 2020-10-04 09:11 Quote from: BSaidus on October 02, 2020, 03:08:22 pmHello. Add interfaces to your uses unit and check the paths inside your fpc.cfg located in the fpc\bin\i386-win32 folder. then proceed . Ok thanks! I'll check that and I will let you know👍😉 ---------------------------------------------------------------------- Kasia · 2020-10-05 15:05 Hello, I have a problem. I don't know if I'm doing it right, but I have now code like this: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i program project1; {$mode objfpc}{$H+}interfaceuses   {$IFDEF UNIX}{$IFDEF UseCThreads}   cthreads,   {$ENDIF}{$ENDIF}   Classes, SysUtils, indylaz, CustApp   { you can add units after this }; type    { TMyApplication }    TMyApplication = class(TCustomApplication)   protected      procedure DoRun; override;   public   end; { TMyApplication } procedure TMyApplication.DoRun;var   ErrorMsg: String;begin    { add your program here }    // stop program loop   Terminate;end; var   Application: TMyApplication; {$R *.res} begin   Application:=TMyApplication.Create(nil);   Application.Title:='My Application';   Application.Run;   Application.Free;end.But I get error Quoteproject1.lpr(4,10) Fatal: Syntax error, "BEGIN" expected but "INTERFACE" foundHow do I fix this? And I'm using Linux, not Windows, so I can't go to path pc\bin\i386-win32. ---------------------------------------------------------------------- howardpc · 2020-10-05 15:15 What you need is thisCode: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i program project1 {$mode objfpc}{$H+} uses{$IFDEF UNIX}{$IFDEF UseCThreads} cthreads,{$ENDIF}{$ENDIF}Classes, SysUtils, indylaz, CustApp, Interfaces;  type  // etc. ---------------------------------------------------------------------- BSaidus · 2020-10-05 15:16 Quote from: Kasia on October 05, 2020, 05:05:29 pmHello, I have a problem. I don't know if I'm doing it right, but I have now code like this: But I get error Quoteproject1.lpr(4,10) Fatal: Syntax error, "BEGIN" expected but "INTERFACE" foundHow do I fix this? And I'm using Linux, not Windows, so I can't go to path pc\bin\i386-win32. try this : Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i program project1; {$mode objfpc}{$H+}interfaceuses   {$IFDEF UNIX}{$IFDEF UseCThreads}   cthreads,   {$ENDIF}{$ENDIF}   Classes, SysUtils,    interfaces,                             // add this unit into your uses   indylaz, CustApp   { you can add units after this }; type    { TMyApplication }    TMyApplication = class(TCustomApplication)   protected      procedure DoRun; override;   public   end; { TMyApplication } procedure TMyApplication.DoRun;var   ErrorMsg: String;begin   { add your program here }   // stop program loop   Terminate;end; var   Application: TMyApplication; {$R *.res} begin   Application:=TMyApplication.Create(nil);   Application.Title:='My Application';   Application.Run;   Application.Free;end. ---------------------------------------------------------------------- howardpc · 2020-10-05 16:21 @BSaidus Programs do not have an interface section, this is only for units. ---------------------------------------------------------------------- Kasia · 2020-10-06 14:25 Great, thanks! This error has gone. But appear another one. When I add Indy to project, IdSMTP for example, lazarus shows error that it doesn't recognize this unit. In graphic application this unit is added. What to do with that? I have code like this: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i program project1; {$mode objfpc}{$H+}uses   {$IFDEF UNIX}{$IFDEF UseCThreads}   cthreads,   {$ENDIF}{$ENDIF}   Classes, SysUtils,   interfaces,                           // add this unit into your uses   indylaz, CustApp, idSMTP   { you can add units after this }; type    { TMyApplication }    TMyApplication = class(TCustomApplication)   protected      procedure DoRun; override;   public   end; { TMyApplication } procedure TMyApplication.DoRun;var   ErrorMsg: String;   idmessage:          TIdMessage;   SMTP:               TIdSMTP;begin   { add your program here }   // stop program loop   idMessage := TIdMessage.Create;  SMTP := TIdSMTP.Create;   idMessage.Free;  SMTP.Free;end; var   Application: TMyApplication; {$R *.res} begin   Application:=TMyApplication.Create(nil);   Application.Title:='My Application';   Application.Run;   Application.Free;end. ---------------------------------------------------------------------- PascalDragon · 2020-10-07 07:22 Quote from: Kasia on October 06, 2020, 04:25:05 pmGreat, thanks! This error has gone. But appear another one. When I add Indy to project, IdSMTP for example, lazarus shows error that it doesn't recognize this unit. In graphic application this unit is added. What to do with that? I have code like this: You need to add the Indy package as a dependency in the Project Inspector. ---------------------------------------------------------------------- Kasia · 2020-10-07 15:41 Quote from: PascalDragon on October 07, 2020, 09:22:14 amQuote from: Kasia on October 06, 2020, 04:25:05 pmGreat, thanks! This error has gone. But appear another one. When I add Indy to project, IdSMTP for example, lazarus shows error that it doesn't recognize this unit. In graphic application this unit is added. What to do with that? I have code like this: You need to add the Indy package as a dependency in the Project Inspector. Yes but I've done that already. No results. ---------------------------------------------------------------------- Kasia · 2020-10-08 15:58 OK, I wish to ask about something else - is this common problem? For example if I will switch indy to synapse, this problem won't show anymore?