Difference between revisions of "Lazarus Faq/sk"

From Lazarus wiki
Jump to navigationJump to search
Line 209: Line 209:
 
Virtual key constants sú definované v LCLType. Pridajte LCLtype do <b>uses</b> sekcie.
 
Virtual key constants sú definované v LCLType. Pridajte LCLtype do <b>uses</b> sekcie.
  
== Using the IDE ==
+
== Používame IDE ==
  
=== How can I use "identifier completion"? ===
+
=== Ako sa používa doplňovanie identifikátorov? ===
You can invoke identifier completion by pressing [ctrl][space].
+
Doplňovanie identifikátorov vyvoláte stlačením kláves [ctrl][medzera].
Under the menu item ''Environment -> Editor Options -> Code Tools -> Automatic Features'' you can set how quick this should happen automatically.
+
V menu ''Environment | Editor Options | Code Tools | Automatic Features'' môžete nastaviť, ako dlho má trvať, kým sa doplňovanie identifikátorov objaví automaticky.
  
 
== Linux ==
 
== Linux ==

Revision as of 17:07, 24 December 2008

العربية (ar) Deutsch (de) English (en) español (es) français (fr) magyar (hu) italiano (it) 日本語 (ja) 한국어 (ko) português (pt) русский (ru) slovenčina (sk) 中文(中国大陆)‎ (zh_CN) 中文(台灣)‎ (zh_TW)

Tento FAQ bol zkopírovaný z FAQ na adrese www.freepascal.org, je jednoduchšie sa oň starať a rozširovať ho, keď je vo wiki formáte.

Všeobecné otázky

Kde môžem nájsť viacero FAQ?

Pozrite sa na oficiálnu stránku. Nájdete tam ďalší FAQ.

Prečo sú generované binárky také veľké?

Binárky sú veľké pretože obsahujú množstvo ladiacich informácií potrebných pre gdb (GNu Debugger).

Prekladač má prepínač na vypnutie lediacich informácií v binárnom súbore (-Xs), ale vďaka chybe v prekladači (verzia 2.0.2 a skoršie), tento nefunguje správne. Chyba bola opravená vo vývojovej verzii prekladača.

Na odstránenie ladiacich symbolov zo spustiteľného súboru môžete použiť program zvaný "strip", nájdete ho v inštalačnom adresári Lazaraus lazarus\pp\bin\i386-win32\.

Jednoducho v príkazovom riadku napíšte príkaz "strip --strip-all <váš exe súbor>".

Ak chcete mať svoj program ešte menší, môžete vyskúšať použiť program UPX. UPX je veľmi dobrý kompresor pre vykonateľné súbory. Vďaka tomu, že binárku komprimuje priamo ("na mieste"), nemá žiadne problémy s prílišným vyťažením pamäte. Okrem toho má veľmi rýchlo dekompresiu (~10 MB/s na Pentiu 133).

UPX spustíte zadaním "upx <váš exe súbor>" v príkazovom riadku.

Po použití programu strip aj upx sa jednoduchá GUI aplikácia v Lazare zmenší na:

  • ~ 700kb na Linuxe
  • ~ 420kb na Windows

Detailnejšiu odpoveď na túto otázku môžete nájsť tu.

Lazarus vs cpp.png

Je dôležté si uvedomiť, že už program hello world v Lazarus zahŕňa veľké množstvo vlastností:

  • Knižnicu obsluhy XML
  • Knižnicu oblsuhy obrázkov pre súbory png, xpm, bmp a ico
  • Skoro všetky nástroje z Lazarus Component Library
  • Celú Free Pascal Runtime Library

Takže je veľmi veľký, ale už obsahuje skoro všetko, čo skutočná netriviálna aplikácia bude potrebovať.

Veľkosť spustiteľných súborov z Lazarus ja na začiatku veľká, ale narastá veľmi pomaly, vďaka spôsobu akým prekladač Free Pascal a fomruláre Lazarus pracuje. Projekt C++ (len príklad, ale aplikovateľný aj na iné jazyky/nástroje) má hello world veľmi malý, ale rýchlo exponencionálne narastá, keď potrebujete vlastnosti pre napísanie netriviálnch aplikácií.


Prečo je linkovanie vo Windows také pomalé?

Všeobecne povedané, preklad vo Windows zaberie viac času ako na iných platformých, pretože GNU Linker používaný Free Pascalom pracuje na tejto platforme pomaly. Tento problém ovplyvňuje len Windows a len na relatívne starých počítačoch (menej ako 1Ghz) a počítačoch s malou (128MB a menej).

Rovnako, ak smrtlinkujete LCL, bude linkovanie ešte pomalšie. Štúdiu o týchto problémoch môžete nájsť tu: File size and smartlinking

Tento problém sa týka iba Windows, a iba na relatívne starších počítačoch (menej ako 1Ghz) a a počítačoch s málo RAM RAM (128MB alebo menej).

Bol vyvinutý interný linker a je pripravený, ale bude dostupný len po uvoľnení Free Pascal 2.(samozrejme je dostupný cez subversion). Dramaticky skracuje linkovanie.

Poznámka: V 2.1.1 Windows používa interný pre win32/64/ce, ktorý proces trochu zrýchľuje. Rekompilácia Lazarus potom zaberie okolo 280MB.

Potrebujem ppc386.cfg alebo fpc.cfg?

Potrebujete iba fpc.cfg. Toto je ten správny spôsob, ako prekladaču oznámiť, kde má hľadať knižnice.

Ako skompilujem lazarus?

Urobte niečo ako toto:

$ cd lazarus
$ make clean all

Ako vytvorím iné projekty založené na LCL?

Pokiaľ nemôžete použiť IDE pre zostavenie vašej aplikácie, pridajte na koniec súboru fpc.cfg nasledujúce riadky:

  1. Pridá knižnice
 -Fu/your.lazarus.root/lcl/units
 -Fu/your.lazarus.root/lcl/units/{váš_toolkit}
 -Fu/your.lazarus.root/components/units
 -Fu/your.lazarus.root/components/units/{váš_toolkit}
Kde {váš_toolkit} môže byť GTK, Gnome alebo Win32 a potom spustite:
ppc386 vasprojekt.pp

Akú verziu FPC potrebujem?

Používajte verzi 2.2.2 pre všetky operačné systémy.

Nemôžem skompilovať Lazarus

  1. Overte si, či máte prekladač správnej verzie
  2. Overte si, či sú (fpc) knižnice taktiež z tej istej verzie.
  3. Overte si, či máte fpc.cfg a nie starý ppc386.cfg
  4. Taktiež si pozrite FAQ vzťahujúce sa k vášmu OS

Keď sa pokúšam kompilovať projekt, dostanem chybovú hlášku

"Cannot find Unit interfaces". Ako to vyriešiť?

Tento skompilovaný unit by sa mal nachádzať v {LazarusDir}/lcl/units/{TargetCPU}-{TargetOS}/{LCLWidgetSet}/interfaces.ppu.

Uistite sa, že je iba jeden. Ak máte niekoľko verzií interfaces.ppu, tak pravdepodobne mát echybu v konfigurácii (napríklad ste pridali lcl adresár do vašej cesty). Zmažte všetky interfaces.ppu okrem toho vo vyššie definovanom adresári.

Ak používate iný widgetset, než ten, pre aký ste skompilovali Lazarus, musíte taktiež pre tento widgetset skompilovať aj LCL.

Ak ste sa dostali sem, ale stále sa zjavuje chybová hláška, tak používate iný prekladač / rtl pre kompilovanie vášho projektu ako ten, ktorý bol použitý pre skompilovanie Lazarus IDE. Môžete urobiť nasledovné:

  • urobiť rebuild LCL (alebo Lazara kompletne) s prekladačom, ktorý zvolíte v Environmnent Options. Urobíte to v menu Tools -> Build Lazarus. Avšak predtým si prezrite a prípadne upravte nastavenia pre build v Tools -> Configure Build Lazarus.
  • Zmeňte prekladač v Environment Options na ten, ktorý ste použili pre skompilovanie Lazara. Pozorne si prezrite taktiež Environment Options a presvedčte sa, že máte nastavenú správnu cestu pre Lazarus Directory (inštalačný adresár Lazarus) a FPC sources directory (zdrojové adresáre pre fpc unity). Overte si, že v konfiguračnom súbore fpc.cfg máte iba jednu verziu prekladača - na Linuxe a iných unixových systémoch by sa tento súbor mal nachádzať v adresári /etc a na Windows v rovnakom adresári ako fpc prekladač. Kópie starých verzií súboru taktiež ostávajú v systéme, keď updatujete váš prekladač na novšiu verziu a môžu spôsobovať problémy, môžu sa nachádzať vo vašom domovskom adresári, alebo v tom istom adresári, v ktorom ste budovali váš nový prekladač. ZMAŽTE ICH!!
  • Môžete tiež skúsiť zmeniť widgeset pre aktuálny projekt. Napr. ukážkový project "objectinspector", ktorý je súčasťou inštalácie Lazara je nastavený na gtk. Kompilovanie tohoto projektu určite skončí v chybe "Can't find unit interfaces" na platforme Windows. Zmenou widgesetu na default(Win32) v Project | Compiler Options ... | LCL Widget Type (various) môže odstrániť tento problém.

Keď sa pokúšam skompilovať Delphi projekt v Lazare, dostanem chybovú hlášku

at the line :{$R *.DFM} Ako vyriešim tento problém?

Lazarus (alebo lepšie Linux) nepozná resourcy, takže ich nemôžete používať takým spôsobom ako robí Delphi/win32. Lazarus však používa tomuto vcelku kompatibilnú metódu. Pokiaľ sa budete riadiť nasledovným, tak stále môžete používať vaše Delphi layouty (.dfm súbory):

  • Potrebujete textovú verziu .dfm súboru. Delphi5 a vyššie to majú predvolené. Ak máte staršie súbory:: skratkou ALT-F12 si prezriete layout ako text a potom cut&paste. Keď už máte textový .dfm file, proste ho skopírujte do .lfm súboru.
  • S pomocou lazres (v lazarus/tools) vytvorte súbor.
 lazres vas_formular.lrs vas_formular.lfm
  • Pridajte nasledovnú inicializačnú sekciu
     initialization
     {$I yourform.lrs}

Prosím, pamätajte na to, že nie všetky vlastnosti v dfm sú podporované Lazarom, takže vám IDE môže spadnúť.

'Identifier not found LazarusResources'.

Pri vytváraní formulára Lazarus automaticky pridáva niekoľko extra unitov do uses sekcie vášho formulárového unitu. Počes konverzie z delphi unitu do lazarovho unitu sa toto nedeje. Čiže LResources potrebujete do uses sekcie vášho formulárového unitu pridať ručne.

Pri prístupe k udalostiam objektov objektov, napríklad udalosti onclick pre tlačidlo, dostanem nasledujúcu chybu: ERROR unit not found: stdCtrls

Uistite sa (v Project -> Project Inspector), že váš projekt závisí na balíčkoch LCL a že ste nainštalovali zdrojové súbory FPC.

Lazarus pozostáva z IDE a z knižnice vizuálnych komponentov LCL. Všetko ostatné, ako IO, databázy, FCL a RTL sú poskytované FPC. IDE potrebuje poznať cesty ku všetkým týmto zdrojom.

Cestu k FPC zdrojom môžete nastaviť cez: Environment -> General Options -> Files -> FPC source path

Ako vložím malý súbor do spustitelného súboru? Ako vložím resource?

/your/lazarus/path/tools/lazres sound.lrs sound1.wav sound2.wav ...

vytvorí súbor sound.lrs zo súborov sound1.wav a sound2.wav.

Potom ho môžete includnuť *za* lrs súborom formulára:

...
initialization
{$i unit1.lrs} // hlavný resource súbor (vždy prvý !)
{$i sound.lrs} // vlastný resource súbor

end.

V programe potom môžete použiť napr.:

Sound1AsString:=LazarusResources.Find('sound1').Value;

Ako sa dostanem k debug výstupu?

V unite LCLProc sa nachádzajú dve procedúry pre písane do debug výstupu:

  • DebugLn: funguje rovnako ako WriteLn, ale písať sa do nej dajú len textové reťazce (string).
  • DbgOut: funguje rovnako ako Write, ale písať sa do nej dajú len textové reťazce (string).

Za normálnych okolností sa debug výstup píše do stdout. Pokiaľ stdout nie je otvorený (typ aplikácie je {$AppType Gui} alebo je skompilovaná pod Windows s prepínačom -WG), výstup sa nepíše vôbec.

Debug výstup sa môže tiež zapisovať do súboru. Inicializačný kód v unite LCLProc skontroluje, či sa v príkazovom riadku nenachádza parameter '--debug-log=<file>'. Pokiaľ sa nachádza, všetok debug výstup sa píše do súboru <file>.

Pokiaľ sa v príkazovom riadku nenájde parameter '--debug-log', LCLProc skontroluje systémovú premennú xxx_debuglog (xxx je názov programu bez prípony, čiže napr. pre Lazarus hľadá premennú lazarus_debuglog). Pokiaľ takáto systémová premenná existuje, debug výstup sa zapíše do nastaveného súboru. Napr. nastavením:

set lazarus_debuglog=c:\lazarus\debug.txt

sa bude debug výstup programu Lazarus zapisovať do súboru c:\lazarus\debug.txt.

Keďže táto funkcionalita je implementovaná v unite LCLProc, je prístupná pre každú aplikáciu, ktorá túto unitu používa.

Debugovanie Lazarusu
Najmä pre používateľov Windows: Pokiaľ chcete, aby Lazarus vypisoval do konzoly, pridajte {$APPTYPE console} do súboru lazarus.pp a prekompilujte Lazarus.

Aký je význam prípon rôznych súborov, ktoré Lazarus používa?

Lazarus Tutorial/sk#The Lazarus files uvádza niektoré príklady. Tu je stručný zoznam:

*.lpi
Lazarus Project Information file - informácie o projekte (uložený v XML; obsahuje nastavania špecifické pre konkrétny projekt)
*.lpr
Lazarus Program file; obsahuje pascalovský zdrojový kód hlavného programu
*.lfm
Lazarus Form file; obsahuje vlastnosti všetkých objektov na formulári (uložený v Lazarovskom špeciálnom textovom formáte; akcie sú uložené v Pascale v príslušnom .pas súbore)
*.pas or *.pp
Programová jednotka (Unit) v Pascale (obvykle zodpovedá nejakému formuláru uloženému v súbore *.lfm)
*.lrs
Lazarus Resource file (toto je generovaný súbor, nemýľte si ho s resource súbormi Windows).
Súbor sa dá vytvoriť pomocou pomôcky lazres (v adresári Lazarus/Tools) príkazom: lazres myfile.lrs myfile.lfm
*.ppu
Compiled unit (skompilovaná unita)
*.lpk
Lazarus package information file - informácie o balíčku (uložený v XML; obsahuje nastavenia špecifické pre konkrétny balíček)

Opravil som chybu/vylepšil som Lazarus. Ako dostanem moje zmeny do oficiálnych zdrojových kódov?

Vytvorte záplatu a pošlite ju vývojarom. Viac detailov v Creating A Patch.

Pokiaľ deklarujem textový súbor ako var mytext: text;, dostanem chybu "Unit1.pas(32,15) Error: Error in type definition". Ako to opraviť?

Trieda TControl má vlastnosť Text. V metóde formulára sa teda nepoužije typ Text zo systémovej unity. Môžete použiť typ TextFile, ktorý je len aliasom typu Text, alebo môžete pridať meno unitu do definície typu.

var
  MyTextFile: TextFile;
  MyText: System.Text;

Rovnaký problém s duplicitnými menami nastáva pri priraďovaní (assign) a zatváraní (close) textových súborov. TForm má vlastnosť assign a metódu Close. Môžete použiť AssignFile a CloseFile ale pridať meno unity System.

Dostávam chybu pri tlačení pomocou Printer.BeginDoc

Unita Printers musí byť pridaná v uses sekcii.

Balíček Printer4Lazarus musí byť pridaný do závislostí projektu. Kliknite na: Project | Project Inspektor | Add | New Requirement | Package Name

Pokiaľ balíček Printer4Lazarus nie je v zozname, musí sa doinštalovať. Balíček je súšasťou inštalácie Lazara a nájdete ho v adresári [adresár kde je lazarus nainštalovaný]\components\printers.

Tento istý postup funguje aj v prípade chyby, ktorú môžete dostať pri použití Printer.Printers

Prečo je TForm.ClientWidth/ClientHeight rovnaká ako TForm.Width/Height?

TForm.Width/Height neobsahujú okraj formulára (narozdiel od napr. Delphi), pretože je nemožné zístiť jeho veľkosť na všetkých platformách.

V prípade, že sa nájde spolahlivý spôsob, ako zistiť velkosť okraju, toto bude v budúcnosti opravené.

Ako sa môžem stať vývojarom Lazara a získať prístup k menežmentu SVN a bug-trackeru?

Tak po prvé: Najprv sa o Lazarovi musíte veľa naučiť a ukázať vaše vedomosti a zručnosti. Začnite čítanim wiki článkov, prečítajte si zdrojový kód Lazara, opravte niekoľko chýb a keď si myslíte, že ste pripravení, kontaktujte vývojarov na mailing liste.

Kde je definované ... ?

Virtual key constants

Virtual key constants sú definované v LCLType. Pridajte LCLtype do uses sekcie.

Používame IDE

Ako sa používa doplňovanie identifikátorov?

Doplňovanie identifikátorov vyvoláte stlačením kláves [ctrl][medzera]. V menu Environment | Editor Options | Code Tools | Automatic Features môžete nastaviť, ako dlho má trvať, kým sa doplňovanie identifikátorov objaví automaticky.

Linux

How can I debug on Linux without the IDE?

First of all you need a debugger. gdb is the standard debugger under linux and there are several GUI-frontends available. One common frontend is ddd, which is part of most common distributions. To compile lazarus/lcl with debug-information you should then use the following commands to start a debug session:

 $ make clean; make OPT=-dDEBUG
 $ ddd lazarus

Be warned however, that ddd is not as comfortable as e.g. the Lazarus debugger. Specially if it comes to view the contents of a variable you have to take into account that ddd/gdb are case sensitive whereas Pascal is case-insensitive. Therefore you have to type all variable names in uppercase to see their contents. For more information take a look into the fpc-manuals.

I can debug now but ddd does not find my sources or complains that they contain no code. Whats that?

This is a path-related problem with either gdb or ddd. You can aviod this by

  • Use the "Change directory" command from the ddd menu and choose the directory where the sources are located. The drawback of this method is that you now can't use the source of the program you started with (e.g. lazarus). Thus it may be neccessary to change the directory multiple times.
  • In ddd goto [Edit] [gdb-settings] and set the search-path
  • Create a $(HOME)/.gdbinit file like:
     directory /your/path/to/lazarus
     directory /your/path/to/lazarus/lcl
     directory /your/path/to/lazarus/lcl/include

I receive an error during the linking that states /usr/bin/ld can't find -l<some lib>

Package Based Distributions
You need to install the package that provides the lib<somelib>.so or lib<somelib>.a files. Dynamic libs under linux have the extension .so, while static libs have the extension .a. On some Linux distro's you have installed the package (rpm, deb) <packagename> which provides <some lib>, but you also need the development package (rpm, deb), normally called <packagename>-dev, which contains the .a (static lib) and/or the .so (dynamic lib).
Source Based Distributions and Manual Compilation (LFS)
Make sure that there is a lib<somelib>.a in the path, and that it contains the right version. To let the linker find the dynamic library, create a symlink called lib<some lib>.so to lib<some lib><version>-x,y.so if necessary (and/or for static lib; lib<some lib>.a to lib<some lib><version>-x,y.a).
FreeBSD
As source based distro's, and also make sure you have -Fl/usr/local/lib in your fpc.cfg and/or Lazarus library path. Keep in mind that GTK1.2 has "gtk12" as package name under FreeBSD. (same for glib)
NetBSD
As source based distro's, and also make sure you have -Fl/usr/pkg/lib in your fpc.cfg and/or Lazarus library path

How can I convert a kylix 2 project into a lazarus project?

Nearly the same way as converting a Kylix project into a Delphi/VCL project.

The LCL (Lazarus Component Library) tries to be compatible to Delphis VCL. Kylix CLX tries to be QT compatible. Here are some general hints:

  • Rename all used CLX Q-units like QForms, QControls, QGraphics, ... into their VCL counterparts: Forms, Controls, Graphics, ...
  • Add LResources to the uses section of every form source
  • Rename or copy all .xfm files to .lfm files.
  • Rename or copy .dpr file to .lpr file.
  • Add "Interfaces" to the uses section in the .lpr file.
  • Remove {$R *.res} directive
  • Remove {$R *.xfm} directive
  • Add {$mode objfpc}{$H+} or {$mode delphi}{$H+} directive to .pas and .lpr files
  • Add an initialization section to the end of each form source and add an include directive for the .lrs file (lazarus resource file):
 initialization
   {$I unit1.lrs}
The .lrs files can be created via the lazres tool in: (lazarusdir)/tools/lazres.
For example: ./lazres unit1.lrs unit1.lfm
  • Fix the differences. The LCL does not yet support every property of the VCL and the CLX is not fully VCL compatible.

When compiling lazarus the compiler can not find a unit. e.g.: gtkint.pp(17,16) Fatal: Can't find unit GLIB

1. Check a clean rebuild: do a 'make clean all'

2. Check if the compiler has the correct version (2.0.0 or higher)

3. Check if the compiler is using the right config file. The normal installation creates /etc/fpc.cfg. But fpc also searches for ~/.ppc386.cfg, ~/.fpc.cfg, /etc/ppc386.cfg and it uses only the first it finds.

Hint: You can see which config file is used with 'ppc386 -vt bogus'
Remove any ppc386.cfg as it is really obsolete.

4. Check if the config file (/etc/fpc.cfg) contains the right paths to your fpc libs. There must be three lines like this:

   -Fu/usr/lib/fpc/$fpcversion/units/$fpctarget
   -Fu/usr/lib/fpc/$fpcversion/units/$fpctarget/rtl
   -Fu/usr/lib/fpc/$fpcversion/units/$fpctarget/*
The first part of these paths (/usr/lib/fpc) depends on your system. On some systems this can be for example /usr/local/lib/fpc/... .
Hint: You can see your searchpaths with 'ppc386 -vt bogus'

5. Check that the config file (/etc/fpc.cfg) does not contain search paths to the lcl source files (.pp, .pas):

 forbidden: -Fu(lazarus_source_directory)/lcl
 forbidden: -Fu(lazarus_source_directory)/lcl/interfaces/gtk
If you want to add the lcl for all your fpc projects, make sure that the two paths look like the following and are placed after the above fpc lib paths:
 -Fu(lazarus_source_directory)/lcl/units/$fpctarget
 -Fu(lazarus_source_directory)/lcl/units/$fpctarget/gtk

6. Check if the missing unit (glib.ppu) exists in your fpc lib directory. For example the gtk.ppu can be found in /usr/lib/fpc/$version/units/i386-linux/gtk/. If it does not exists, the fpc lib is corrupt and should be reinstalled.

7. Check if the sources are in a NFS mounted directory. In some cases the NFS updates created files incorrectly. Please, try to move the sources into a non NFS directory and compile there.

I have installed the binary version, but when compiling a simple project, lazarus gives: Fatal: Can't find unit CONTROLS

Probably you are using a newer fpc package, than that used for building the lazarus binaries. The best solution is to download the sources and compile lazarus manually. You can download the source snapshot or get the source via svn:

 $ bash
 $ svn checkout http://svn.freepascal.org/svn/lazarus/trunk lazarus
 $ cd lazarus
 $ make clean all

Make sure that lazarus get the new source directory: Environment->General Options->Files->Lazarus Directory Top

Lazarus compiles, but linking fails with: libgdk-pixbuf not found

Either install the gdk-pixbuf library for gtk1.x or disable the use:

Where to find the gdk-pixbuf library:

RPMs: http://rpmfind.net/linux/rpm2html/search.php?query=gdk-pixbuf&submit=Search+...&system=&arch=

Debian packages: libgdk-pixbuf-dev

Sources: ftp://ftp.gnome.org/pub/gnome/unstable/sources/gdk-pixbuf/


How to disable the use in lazarus: In Tools->Configure "Build Lazarus" add the option '-dNoGdkPixBufLib' or at command line: "make clean all OPT=-dNoGdkPixBufLib".

I have SuSE and I get /usr/bin/ld: cannot find -lgtk Error: Error while linking

SuSE installs the gtk devel libs under /opt/gnome/lib (or /opt/gnome/lib64 for 64 bits), which is not in the standard lib path. Simply add it to your /etc/fpc.cfg. (-Fl/opt/gnome/lib).

Lazarus crashes with runtime error 211 after I installed a component

After I installed a component, Lazarus crashes with the following message:

Threading has been used before cthreads was initialized.
Make cthreads one of the first units in your uses clause.
Runtime error 211 at $0066E188

How can I fix this?

Your freshly installed component is using threads. Fpc on *nix doesn't automatically include threading support, but it must be intialized. This initialization is done in the cthreads unit. Every application using the component needs to add this unit to the uses clause of the main program. Lazarus itself is no exception. This can be done in two ways:

1) Change the source of ide/lazarus.pp: add the cthreads as first unit to the uses clause, so that is looks like this:

uses
  //cmem,
  cthreads, 
  {$IFDEF IDE_MEM_CHECK}
...

and rebuild lazarus.

2) In order to avoid modifying lazarus.pp file, a fpc compiler option could be used. Once package that uses threads has been compiled, open menu Tools->Configure "build Lazarus". Configure "build Lazarus" dialog will be shown, in field "Options:" type -Facthreads and then press "OK" button. The next step is to install the package. Lazarus will be built with option -Facthreads which means that it will treat main program as if unit cthreads where first in uses clause.

Hint: Maybe your old (non-crashing) lazarus executable is stored as lazarus.old in the same directory as the crashing lazarus executable.

When I run a program with threads I get runtime error 232

The complete error message is:

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

Solution: Add cthreads as first unit to the uses clause of your main program, usually the .lpr-file.

I have Ubuntu Breezy and my fonts in Lazarus IDE look too big

If Lazarus is compiled with Gtk1.2, the settings in Gnome Preferences/Font don't have any effect as they are related to Gtk2. You could try this solution: Create a file named .gtkrc.mine in your home directory (if it's not already there) and add these lines to it:

style "default-text" {
       fontset = "-*-arial-medium-r-normal--*-100-*-*-*-*-iso8859-1,\
                  -*-helvetica-medium-r-normal--*-100-*-*-*-*-*-*"
}

class "GtkWidget" style "default-text"

How can I compile a program for Gtk2?

At the moment, the Gtk2 compiled IDE is a little unstable, but you can compile software for Gtk2 using the Gtk1 IDE.

To start with recompile LCL for Gtk2. Go to the menu "Tools"->"Configure Build Lazarus" and set LCL to clean+build and everything else to none.

Now click Ok and go to the menu "Tools"->"Build Lazarus"

Now you can compile your software with Gtk2 going on the Compiler options and changing the widgetset to Gtk2.

Windows

When I cycle the compiler, I get:The name specified is not recognized as an internal or external command, operable program or batch file.>& was unexpected at this time.

In the compiler dir exists an OS2 scriptfile named make.cmd. NT sees this also as a script file, so remove it since on NT we don't need it.

When I cycle the compiler, I get: make[3]: ./ppc1.exe: Command not found

I don't know why but somehow make has lost its path. Try to cycle with a basedir set like: make cycle BASEDIR=your_fpc_source_dir_herecompiler

When I try to make Lazarus I get:

make.exe: * * * interfaces: No such file or directory (ENOENT). Stop.make.exe: * * * [interfaces_all] Error 2

You need to upgrade your make.

makefile:27: *** You need the GNU utils package to use this Makefile. Stop.

Make sure you didn't install FPC in a path with spaces in the name. The Makefile doesn't support it.


Ako nastavím aplikáciu aby vyzerala ako XP ?

Ak máme program myprogram.exe vytvoríme súbor nazvaný myprogram.exe.manifest a skopírujeme doň nasledujúci text:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity processorArchitecture="*" version="1.0.0.0" type="win32" name="myprogram"/>
<description>programom</description>
<dependency>
  <dependentAssembly>
   <assemblyIdentity
     type="win32"
     name="Microsoft.Windows.Common-Controls"
     version="6.0.0.0"
     publicKeyToken="6595b64144ccf1df"
     language="*"
     processorArchitecture="*" />
  </dependentAssembly>
  </dependency>
</assembly>

Voila! a máme XP vzhľad.

When I run Windows program created in Lazarus it starts with a DOS window

Specify the -WG argument (Windows GUI) on the command line of the compiler or in the Lazarus IDE check the Windows GUI check box on the compiler options dialog box (Project menu -> Compiler Options -> Linking -> target OS Specific options.


Contributors and Comments

This page has been converted from the epikwiki version.