Recent

Author Topic: Cthreads error  (Read 5007 times)

greertr

  • Full Member
  • ***
  • Posts: 113
    • Virtual Pilot Dashboard
Cthreads error
« on: January 10, 2017, 02:36:26 am »
I have cthreads in a little test prog for themapviewer, and I get a compile error stating that cthreads cant be found

Code: Pascal  [Select][+][-]
  1. Compile Project, Target: testmapviewergl.exe: Exit code 1, Errors: 1
  2. testmapviewergl.lpr(6,3) Fatal: Cannot find cthreads used by testmapviewergl of the Project Inspector.
  3.  

apparently thecthread is provided by the System unit and links to the C library of the system. 

Am I missing the C library for some reason?  Where to get it?

ok, I found a page that explains this and I'm workingthrough it - pita!
http://wiki.freepascal.org/Creating_bindings_for_C_libraries
« Last Edit: January 10, 2017, 02:47:40 am by greertr »

molly

  • Hero Member
  • *****
  • Posts: 2330
Re: Cthreads error
« Reply #1 on: January 10, 2017, 02:40:39 am »
your target reads .exe, so assuming your target is windows.

Whenever i start a new project, lazarus does automatically for me:
Code: Pascal  [Select][+][-]
  1.   {$IFDEF UNIX}{$IFDEF UseCThreads}
  2.   cthreads,
  3.   {$ENDIF}{$ENDIF}
  4.  
Now... what would that $IFDEF UNIX mean ?

ps: to put it into other words... why would you want to use unit cthreads on windows ? More information on the subject of multithreading and specific units usage for that can be read here.
« Last Edit: January 10, 2017, 02:53:58 am by molly »

greertr

  • Full Member
  • ***
  • Posts: 113
    • Virtual Pilot Dashboard
Re: Cthreads error
« Reply #2 on: January 10, 2017, 11:03:36 am »
trust me, i dont want to!

just trying to get the map view component test prog to work

looks to be over my paygrade right now...this whole c bindings thing is way in the weeds!
« Last Edit: January 12, 2017, 01:57:52 am by greertr »

molly

  • Hero Member
  • *****
  • Posts: 2330
Re: Cthreads error
« Reply #3 on: January 10, 2017, 05:09:33 pm »
Greertr,

The point i was trying to make is that you shouldn't (have to).

Unless the source you are trying to compile only supports posix targets you should be able to compile it out of the box. It would be similar as if i gave you a source-project that makes use of unit windows and you are trying to compile that for linux and/or MacOS.

Are you able to point to the sources ?, as i have no idea what (map) project you are talking about (there are a few of them out there).
« Last Edit: January 10, 2017, 05:14:19 pm by molly »

greertr

  • Full Member
  • ***
  • Posts: 113
    • Virtual Pilot Dashboard
Re: Cthreads error
« Reply #4 on: January 12, 2017, 12:23:27 am »
it is osm

I tried removing cthreads from the Uses, but it epic fails

thx
« Last Edit: January 12, 2017, 01:58:25 am by greertr »

molly

  • Hero Member
  • *****
  • Posts: 2330
Re: Cthreads error
« Reply #5 on: January 12, 2017, 12:44:45 pm »
it is osm
No offense, but that exactly tells me shite (yes, i know it stands for open street map).

So after picking my brain on why google was unable to find the named units or components used in the test-project, i managed to find something on the forums that linked me to some google-code.

Quote
I tried removing cthreads from the Uses, but it epic fails
It epically works for me so we must be doing something different (mind you, i can compile the project. not saying explicitly the test project actually works).

Also your reaction seem to imply that removing cthreads is giving you the 'epic failure' while that is at the least misleading as the produced errors are originating from issues that are completely unrelated to cthreads.

So, after i was forced to install packages rgbgraphics and synapse the problems with compiling the test project became more clear:
- you need to add mapviewer dependency using project inspector
- do not use cthreads when compiling for windows. I already gave the solution for that.
- unit mvMapOperator does not exist so i commented that unit out wherever it was used.
- Type TTileId could not be found as unit mvmapprovider (which declares that type) was not in uses clause.
- Compiler complained about method TMapViewerEngine.Redraw inside unit mvengine about int64 (x and y variables) not being ordinary type, so i changed those to be of type integer instead.

I was able to make that above list based on what the compiler returned for me when attempting to compile/install things.

Strange that you are not able to provide a single error message and instead being persistent about cthreads/bindings   :o

Compiler generated errors do not fall into the category "epic failure" but in the category "look, i the compiler am confused because something was done wrong, please help me".  :)

J-G

  • Hero Member
  • *****
  • Posts: 953
Re: Cthreads error
« Reply #6 on: January 12, 2017, 12:55:48 pm »
Molly  -  you are too kind  :)
FPC 3.0.0 - Lazarus 1.6 &
FPC 3.2.2  - Lazarus 2.2.0 
Win 7 Ult 64

greertr

  • Full Member
  • ***
  • Posts: 113
    • Virtual Pilot Dashboard
Re: Cthreads error
« Reply #7 on: January 12, 2017, 01:44:04 pm »
well, thx again for the help - I should be able to get it going now  :-[

UPDATE:  got it running without error or complaint, but the map doesn't draw, just get the red-fill image.
« Last Edit: January 12, 2017, 03:22:32 pm by greertr »

 

TinyPortal © 2005-2018