Recent

Author Topic: Multithreading on Linux -- "Recompile the application with a thread-driver"?  (Read 10083 times)

Troodon

  • Sr. Member
  • ****
  • Posts: 484
I keep getting this error message upon tryng to launch worker threads on Linux, despite including the cthreads and cmem units in the uses clause of the .lpr file as per http://wiki.lazarus.freepascal.org/Multithreaded_Application_Tutorial#Units_needed_for_a_multithreaded_application

Where else should I look? Thanks.

Code: [Select]
This binary has no thread support compiled in.
Recompile the application with a thread-driver in the program uses clause before other units using thread.
Runtime error 232 at...

Code: [Select]
program project2;

{$mode objfpc}{$H+}

uses
  {$IFDEF UNIX}{$IFDEF UseCThreads}
  cthreads,
  cmem,
  {$ENDIF}{$ENDIF}
  Interfaces, // this includes the LCL widgetset
  Forms
  { you can add units after this }, {RNDGen,} Unit1, Printer4Lazarus, Unit2,
  Unit3;

{$R manifest.res}                               
« Last Edit: March 10, 2009, 01:07:03 am by Troodon »
Lazarus/FPC on Linux

Leledumbo

  • Hero Member
  • *****
  • Posts: 8114
  • Programming + Glam Metal + Tae Kwon Do = Me
Do you have UseCThreads defined (Usually in Project->Compiler Options->Other)?

Troodon

  • Sr. Member
  • ****
  • Posts: 484
Oops! I made the same mistake again, trying to enter that option in the Linking tab, Options (-k), that is why it didn't work. Thank you.
Lazarus/FPC on Linux

Vincent Snijders

  • Administrator
  • Hero Member
  • *
  • Posts: 2661
    • My Lazarus wiki user page
If I were you, I would just remove {$IFDEF UseCThreads} from the project source and compile the app unconditionally with the thread driver.

The UseCThread is designed for package to notify the main program that is needs thread support.

Troodon

  • Sr. Member
  • ****
  • Posts: 484
Yes, that worked perfectly. Thank you!
Lazarus/FPC on Linux

facom4ever

  • New Member
  • *
  • Posts: 15
Hello,

sorry to up this old topic.

I have same problem on MacOSx

cthreads is declared on lazarus.pp without condition

When I use a component from Indy, I have this error232.
I wrote on Project->Compiler Options->Other. Use fpc.cfg is checked
On custom options I entered as said : UseCThreads

But still 232 error

If I declare cthreads in the project it is even worst. After compilation I have error 211...

Leledumbo

  • Hero Member
  • *****
  • Posts: 8114
  • Programming + Glam Metal + Tae Kwon Do = Me
Quote
On custom options I entered as said : UseCThreads
It should be -dUseCThreads

TurboRascal

  • Hero Member
  • *****
  • Posts: 672
  • "Good sysadmin. Bad programmer."™
Why not simply remove {$IFDEF UseCThreads} directive? You obviously always need thread drivers compiled in this program when UNIX is defined...
Regards, ArNy the Turbo Rascal
-
"The secret is to give them what they need, not what they want." - Scotty, STTNG:Relics