[Lazarus] How to set defines for a project? Lazarus crashes...

Bo Berglund bo.berglund at gmail.com
Tue Feb 9 09:38:59 CET 2016


On Tue, 9 Feb 2016 00:22:21 +0100 (CET), Mattias Gaertner
<nc-gaertnma at netcologne.de> wrote:

>> I tried setting the conditional "UseCThreads" for my test project but
>> even though I can reach the place where this apparently is set:
>> Menu: Project/Project_Options/Custom_Options/Defines
>> it seems not to work!
>
>Do you mean you added -dUseCThreads in Project/Project_Options/Custom_Options,
>but it is not appended to options passed to FPC?

No I did not add the -d in front of the UseCThreads symbol, just the
symbol itself.

I used Menu: Project/Project_Options/Compiler_Options/Custom_Options
This was the only place I found the word Defines, which appears on a
button to the right. It is in subnode Compiler_Options, which did not
sound right to me anyway since I wanted the symbol to be global
including the Lazarus IDE code parser, but I did not find defines
anywhere else...

Then I clicked the button and an input dialog named Defines popped up.
It has a text input box named Define into which I typed UseCThreads
Then I clicked the Add button and this name appeared in the list
below, so I clicked OK and the input dialog disappeared and I was back
in the Custom_Options dialog with nothing showing in the list there.
If I cancel at this point everything works out except for the define
but on the second try I clicked OK and then Lazarus locked up.

> 
>> When I use this dialog to enter the symbol UseCThreads the effect is
>> invisible when I hit OK
>
>Did you enable the checkbox of the define?

I see a checkbox "Build modes" on top of the Custom_Options dialog, is
this the box you mean? I have not checked it.


>>, nothing gets added to the list of
>> defines/options and when I OK on the main options window anyway
>> Lazarus locks up completely!!!
>
>It works here on OS X/carbon. Maybe the bug only appears on your platform.

It should not be any different, Lazarus itself uses the same sources
on all plöatforms as far as I understand. I retrieved 1.6RC2 from svn
when I built Lazarus.

Different workaround solution:

If I open the project file and add this directly on the next line
following the top line "program MyTCPTest":
{$DEFINE UseCThreads}

then it actually does work.
But the Delphi way seems easier with a separate project option for the
defines...


-- 
Bo Berglund
Developer in Sweden





More information about the Lazarus mailing list