[Lazarus] Cannot compile console application, why?

Michael Van Canneyt michael at freepascal.org
Mon Jul 6 07:20:08 CEST 2020



On Mon, 6 Jul 2020, Bo Berglund via lazarus wrote:

> I have created a test application using Lazarus 2.0.8 and fpc 3.0.4 on
> Windows 10.
>
> The purpose is to check some Indy10 TCP communications items before
> putting them into the main project.
>
> So I have created a new project as a console application and
> implemented my test Indy code.
>
> When I use "Run/Quick compile" it reports no errors so then I tried to
> use "Run/Compile" in order to get an executable but now it shows a
> large number of errors of this kind:
>
> IndyTest.lpr(76,1) Error: Undefined symbol: WSRegisterMenuItem

Looks like you have some GUI related code somewhere.

> program IndyTest;
>
> {$mode objfpc}{$H+}
>
> uses
>  {$IFDEF UNIX}
>  cthreads,
>  {$ENDIF}
>  Classes, SysUtils, CustApp,
>  { you can add units after this }
>  crt, //to check keypresses
>  remoteserver, //where the main action happens
>  indylaz;

I suggest to remove indylaz from the uses clause. 
It pulls in some GUI related code, probably some design-time stuff.

Michael.


More information about the lazarus mailing list