Sign in Join
Wiki copytemporary

Lazarus Faq/ko: what changed

Revision 2 to 3. Removed lines have a minus sign; added lines have a plus sign.

OldNewLine
11이 문서는 원래 www.lazarus.freepascal.org 에 있던 것 입니다. 관리 및 확장 면에서 위키가 훨씬 더 유용하기 때문에 이 곳으로 복사되었습니다.
22
33## 일반적인 이야기
44
55### 더 많은 FAQ 를 볼 수 있는 곳은 어디인가요?
66
77[공식 웹사이트](http://www.lazarus.freepascal.org)를 보세요. 그밖의 괜찮은 FAQ 가 있습니다.
88
99### 도대체 실행파일의 크기가 왜 이렇게 큰 겁니까?
1010
1111실행파일의 크기가 큰 이유는 GDB (GNU Debugger) 를 사용하기 위한 많은 정보들을 포함하고 있기 때문입니다.
1212
1313컴파일러에 이 디버깅 정보를 제거하기 위한 옵션 (-Xs) 이 있습니다만, 버전 2.0.2 이전의 컴파일러는 이 기능에 버그가 있기 때문에 제대로 동작하지 않습니다. 이 버그는 현재 개발버전에서는 수정되었습니다.
1414
1515"strip" 이라는 이름의 프로그램을 사용하면 실행파일로 부터 디버그 심볼을 삭제할 수 있습니다. 이 프로그램은 lazarus\pp\bin\i386-win32\\ 에 있습니다.
1616
1717커맨드 라인에서 간단하게 "strip --strip-all \<대상 실행파일의 경로와 이름\>" 을 입력 하세요.
1818
1919실행파일을 좀 더 작게 만들려면, [UPX](http://upx.sourceforge.net/) 가 좋은 해법이 될 것입니다. UPX는 정말 멋진 실행파일 압축기 로서, 압축 해제에 추가적인 메모리가 필요없는 알고리즘을 사용합니다. (역자 주: 이 압축 알고리즘은 [LZO](http://www.oberhumer.com/opensource/lzo/) 라고 불리며, 오래 전 셀빅의 카마수트라 라는 어플에서 사용되었...^^) 또한 상당히 빠른 압축 해제 속도를 가지고 있습니다. (펜티엄 133에서 초당 10 MB 정도)
2020
2121커맨드 라인에서 간단하게 "upx \<압축할 실행파일의 경로와 이름\>" 을 입력 하세요.
2222
2323라자루스로 만든 간단한 GUI 어플리케이션의 경우 strip과 upx를 사용한 후 크기는 다음과 같습니다.
2424
2525- 리눅스 상에서는 ~ 700kb
2626- 윈도우 상에서는 ~ 420kb
2727
2828그렇다고 UPX가 꼭 좋은 것은 아닙니다. UPX에 대한 좀 더 자세한 이야기는 [[Size Matters|크기문제에]] 대한 페이지를 참고하세요.
2929
3030또 한가지 주목해야 할 사실은, 라자루스의 "hello world" 프로그램은 그 자체로 이미 다음에 나열된 많은 기능들을 포함하고 있다는 것 입니다.
3131
3232- XML 제어 라이브러리
3333- png, xpm, bmp 그리고 ico 파일을 다루는 이미지 라이브러리
3434- 라자루스 컴포넌트 라이브러리의 위젯 대부분
3535- 프리 파스칼 런타일 라이브러리 전체
3636
3737큰 크기의 실행파일 이면에는, 사실 이렇게 실제 어플리케이션이 필요로 하는 대부분의 기능들이 이미 들어 있습니다.
3838
3939라자루스 실행파일의 크기는 처음에는 매우 크지만 아주 조금씩 늘어나게 되는데, 이는 프리파스칼 컴파일러와 라자루스가 폼을 다루는 방식 때문 입니다. C++ 프로젝트의 경우 (뭐 다른 언어들도 마찬가지 입니다만) "hello world" 프로그램은 처음에는 매우 작지만 조금만 복잡한 기능을 추가하면, 그 크기가 급격하게 늘어나게 됩니다.
4040
4141![](/wiki-images/d/de/Lazarus_vs_cpp.png)
4242
4343### 윈도 환경에서 링킹이 오래 걸리는 이유는?
4444
4545이 문제는 FPC 2.2 와 라자루스 0.9.24 부터 해결되었습니다. 업데이트 하세요. 이후 설명은 이전 버전에 대한 것 입니다.
4646
4747Generally speaking, compilation on Windows takes more time then other platforms because the GNU Linker utilized by Free Pascal is slow on this platform. This problem only affects Windows, and is only bad on relatively old computers (less then 1Ghz) and computers with little RAM (128MB or less).
4848
4949Also, if you smartlink LCL the linking will be much slower. A study about this is located here: [[File size and smartlinking]]
5050
5151A internal linker was developed, and is ready, but will only be available when Free Pascal 2.2 is released (of course it's also available via subversion). It decreases the linking time dramatically.
5252
5353**Note**: In 2.1.1 Windows uses an internal linker for win32/64/ce which speeds the process up a bit. A Lazarus recompile then eats about 280MB.
5454
5555### ppc386.cfg이나 fpc.cfg이 필요한가요?
5656
5757fpc.cfg만 있으면 됩니다. 이를 통해서 컴파일러는 라이브러리를 어디서 찾아야 하는지 알게 됩니다.
5858
5959### lazarus 는 어떻게 컴파일하나요?
6060
6161다음과 같이 하세요:
6262
63-`$ cd lazarus`\
64-`$ make clean all`
63+```text
64+$ cd lazarus
65+$ make clean all
66+```
6567
6668### LCL 을 이용한 다른 프로젝트는 어떻게 빌드할 수 있나요?
6769
6870프로그램을 만드는데 IDE 를 사용할 수 없다면, lazbuild 를 사용하세요. 이것은 lazarus 프로젝트 및 패키지를 만들기 위한 명령행 버전입니다. LCL 프로그램을 IDE 나 lazbuild 없이 만들려면 다음 행을 *fpc.cfg* 끝에 추가하세요.
6971
70-`  # searchpath for other toolkits (Linux)`\
71-`  -Fu/usr/lib/fpc/$fpcversion/units/$fpctarget/{YourToolKit}`
72+```text
73+ # searchpath for other toolkits (Linux)
74+ -Fu/usr/lib/fpc/$fpcversion/units/$fpctarget/{YourToolKit}
75+```
7276
73-`  # searchpath for other toolkits (Windows)`\
74-` -Fu/{YourLazarusDirectory}/components/units/{YourToolKit}`
77+```text
78+ # searchpath for other toolkits (Windows)
79+ -Fu/{YourLazarusDirectory}/components/units/{YourToolKit}
80+```
7581
7682
7783Where {YourToolKit} may be *gtk2*, *gnome*, *qt* or *win32* and run:
7884
7985
8086ppc386 your.project.pp
8187
8288**Hint:** Don't forget to install the development packages for your toolkit otherwise you might a receive something like: [[Linker message: cannot find -l]].
8389
8490### FPC의 어떤 버전이 필요한가요?
8591
8692MacOSX는 2.0.4, 그 외의 모든 시스템은 2.2.2 버전이 필요합니다. 또한 2.2.3 버전이나 2.3.x 버전의 경우 svn을 통해서 사용하실 수 있습니다. 주의: 2.2.0 버전은 MacOSX에서 파일명의 대소문자 구분 관련 버그가 있습니다.
8793
8894### Lazarus가 컴파일이 되지 않습니다.
8995
90961. 컴파일러가 올바른 버전인지 체크 하십시오.
91972. fpc 라이브러리가 같은 버전인지 체크 하십시오.
92983. fpc.cfg 파일 있는지, 그리고 ppc386.cfg 파일이 오래된 것은 아닌지 체크 하십시오.
93994. 해당 OS관련 FAQ도 체크 하십시오.
94100
95101### When I try to compile a project, I have an error
96102
97103#### "Cannot find Unit interfaces". How can I solve this?
98104
99105It means the compiler can not find the file 'interfaces.ppu' **or** it means it found one, but it is wrong or outdated.
100106
101107This unit can be found in {LazarusDir}\lcl\units\\{TargetCPU}-{TargetOS}\\{LCLWidgetSet}\interfaces.ppu. For example: /home/username/lazarus/lcl/units/i386-linux/gtk/interfaces.ppu.
102108
103109Make sure, it is only there. If you have multiple versions of interfaces.ppu, then you probably have a wrong configuration (for instance you added a lcl directory to a search path). Remove all interfaces.ppu, but the one in the directory above.
104110
105111If you selected a different widgetset than you used to build lazarus, you need to build the LCL for this widgetset.
106112
107113If it is there, but you get this error, you are using a different compiler / rtl for compiling your project than you used for compiling your Lazarus IDE. You can do one of the following
108114
109115- Rebuild the LCL (or Lazarus completely) with the compiler selected in the Environmnent Options. You can do this with Tools -\> Build Lazarus. Before doing this, check the current settings in Tools -\> Configure Build Lazarus.
110116- Change the compiler in the Environment Options to the one you used to compile Lazarus. Look carefully also in the Environment Options to see if you are using the correct paths for the Lazarus Directory and the FPC sources directory. Check that there is only one version of the compiler configuration file fpc.cfg - it should reside in /etc/ for Linux/Unix systems or in the same directory as the fpc compiler for Windows systems. Try to run "fpc -vt bogus" to check which fpc.cfg is being used in your system. Rogue copies often creep in if you have updated your compiler to a new version; they may be found in your home directory or in the same directory as the one in which you built your new compiler. DELETE THESE!!
111117- You may also try to change the widgetset currently selected for the project. For example, the sample project "objectinspector" that comes with Lazarus is set to gtk by default. Compiling this project will surely give you "Can't find unit interfaces" in Windows platform. Changing widgetset to default(Win32) in Project \| Compiler Options... \| LCL Widget Type (various) should fix this issue.
112118
113119### When I try to compile delphi projects under lazarus, I have an error
114120
115121#### at the line :{\$R *.DFM} How can I solve this problem ?
116122
117123Lazarus (or better Linux) doesn't know about resources, so you can't use them in the way Delphi/Win32 does. However Lazarus uses a method pretty compatible with this. You can still use your Delphi layouts (.dfm files) if you use the following steps:
118124
119125- You need a textual version of the .dfm files. D5 and higher are doing this as default. If you have older files: ALT-F12 to see the layout as text and paste/copy. When you have a text .dfm file, just copy it to a .lfm file.
120126- Create a file with lazres (in lazarus/tools) lazres yourform.lrs yourform.lfm
121127- Add the following initialization section to
122128
123-`     initialization`\
124-`     {$I yourform.lrs}`
129+```text
130+ initialization
131+ {$I yourform.lrs}
132+```
125133
126134Please keep in mind that not all properties in the dfm are supported yet by lazarus, so you might get a crash.
127135
128136#### 'Identifier not found LazarusResources'.
129137
130138When creating a form Lazarus automaticaly add some extra units to the uses section of your form unit. During the conversion of a delphi unit to a Lazarus unit this does not happen. So you need to add LResources to the Uses section of your form unit.
131139
132140### When accessing events of objects e.g. the onclick event of a button I get the following error. ERROR unit not found: stdCtrls
133141
134142Make sure, in the Project -\> Project Inspector, that your project depends on the package 'LCL' and that you have installed the FPC sources.
135143
136144Lazarus is the IDE and the visual components library LCL. All other stuff, like IO, Database, FCL and RTL are provided by FPC. The IDE needs the paths to all sources.
137145
138146The FPC source path can be set via: Environment -\> Environment Options -\> Files -\> FPC source directory
139147
140148### How to embed a small file in the executable, without the need of a separate file? How to embed a resource?
141149
142150For example:
143151
144-`/your/lazarus/path/tools/lazres sound.lrs sound1.wav sound2.wav ...`
152+```text
153+/your/lazarus/path/tools/lazres sound.lrs sound1.wav sound2.wav ...
154+```
145155
146156will create sound.lrs from sound1.wav and sound2.wav.
147157
148158Then include it *behind* the form lrs file:
149159
150-`...`\
151-`initialization`\
152-`{$i unit1.lrs} // this is main resource file (first)`\
153-`{$i sound.lrs} // user defined resource file`\
160+``` pascal
161+...
162+initialization
163+{$i unit1.lrs} // this is main resource file (first)
164+{$i sound.lrs} // user defined resource file
154165
155-`end.`
166+end.
167+```
156168
157169In your program you can then use:
158170
159-`Sound1AsString:=LazarusResources.Find('sound1').Value;`
171+``` pascal
172+Sound1AsString:=LazarusResources.Find('sound1').Value;
173+```
160174
161175### 디버그 결과를 어떻게 볼 수 있나요?
162176
163177LCL은 LCLProc 유닛의 2개 프로시져에서 디버그 출력을 작성 할수 있습니다.
164178
1651792개 프로시져 명:
166180
167181- **DebugLn:** which works about the same as WriteLn, but accepts only strings.
168182- **DbgOut:** which works about the same as Write, but accepts only strings.
169183
170184In normal circumstances the output is written to stdout. If stdout is closed, (for example when the application is {\$AppType Gui} or compiled with -WG on Windows), no output is written.
171185
172186Debug output can also be written to file. The initialization code of the LCLProc unit checks Lazarus.exe's command line parameters for '--debug-log=\<file\>'. On finding this parameter any subsequent debug output is sent to \<file\>.
173187
174188만약 '--debug-log' 명령어 파라메터를 사용하지 않으면, 시스템 환경설정의 변수 xxx_debuglog를 검사합니다, xxx는 파일 확장자를 제외한 파일 명입니다. For Lazarus this would be lazarus_debuglog. 만약 환경설정에서 변수가 없다면 lazarus_debuglog 환경설정의 변수 파일을 받아서 디버그 출력합니다.
175189
176190예: 설정하려면:
177191
178-`set lazarus_debuglog=c:\lazarus\debug.txt`
192+```text
193+set lazarus_debuglog=c:\lazarus\debug.txt
194+```
179195
180196디버그 출력은 다음파일에 저장됩니다. c:\lazarus\debug.txt
181197
182198Since this is implemented in lclproc, every application using lclproc, can use this output facility.
183199
184200Debuging Lazarus
185201Most useful for Windows: If you want output on a console, add {\$APPTYPE console} to lazarus.pp ; Then rebuild Lazarus.
186202
187203### What is the meaning of the various file extensions used by Lazarus?
188204
189205The [[Lazarus Tutorial|Lazarus Tutorial#The Lazarus files]] explains some extensions by an example. Here is a brief list:
190206
191207`*.lpi`
192208Lazarus Project Information file (stored in XML; contains project-specific settings)
193209
194210`*.lpr`
195211Lazarus Program file; contains Pascal source of main program
196212
197213`*.lfm`
198214Lazarus Form file; contains configuration information for all objects on a form (stored in a Lazarus-specific textual format; the actions are described by Pascal source code in a corresponding `*.pas` file)
199215
200216`*.pas` or `*.pp`
201217Unit with Pascal code (typically for a form stored in a corresponding `*.lfm` file)
202218
203219`*.lrs`
204220Lazarus Resource file (this is a generated file; not to be confused with a Windows resource file).
205221
206222This file can be created with lazres tool (in directory Lazarus/Tools) using commandline: lazres myfile.lrs myfile.lfm
207223
208224`*.ppu`
209225Compiled unit
210226
211227`*.lpk`
212228Lazarus package information file. (stored in XML; contains package-specific settings)
213229
214230### I have fixed/improved lazarus. How can I add my changes to the official lazarus source?
215231
216232Create a patch and send it to the developers. For details see [[Creating A Patch]].
217233
218234### When I do *var mytext: text;* to declare a text file, I get "Unit1.pas(32,15) Error: Error in type definition". How can I fix this?
219235
220236The TControl class has a [[doc:lcl/controls/tcontrol.text.html|Text]] property. In a method of a form, that has higher visibility, the [[doc:rtl/system/text.html|Text]] type from the system unit. You can use the [[doc:rtl/system/textfile.html|TextFile]] type, which is just an alias for the Text type or you can add the unit to the type definition.
221237
222-`var`\
223-`  MyTextFile: TextFile;`\
224-`  MyText: System.Text;`
238+``` pascal
239+var
240+ MyTextFile: TextFile;
241+ MyText: System.Text;
242+```
225243
226244A similar name clash exists with assigning and closing a text file. TForm has a *assign* and a [[doc:lcl/forms/tcustomform.close.html|Close]] method. You can use [[doc:rtl/objpas/assignfile.html|AssignFile]] and [[doc:rtl/objpas/closefile.html|CloseFile]] or add the unit name *System*.
227245
228246### I get an error when using Printer.BeginDoc
229247
230248The unit Printers must be added to the uses section.
231249
232250The Printer4Lazarus package must be added to your project requirement in the IDE under: Project\|Project Inspector\|Add\|New Requirement\|Package Name:
233251
234252If the package Printer4Lazarus package is not in the list when opening the dropdown box it must be installed. The package is part of the Lazarus installation and can be found in: \[lazarus installed directory\]\components\printers
235253
236254If you used the default installation directories \[lazarus installed directory\] is:
237255
238256- Windows: c:\lazarus
239257- Linux: /usr/lib/lazarus
240258
241259The same solution also applies to the exception you can get when referencing Printer.Printers
242260
243261### Why are TForm.ClientWidth/ClientHeight the same as TForm.Width/Height
244262
245263The TForm.Width/Height do no include the frame, because there was no way to retrieve the frame size on all platforms. Without a reliable way, the LCL would move the forms around on the screen or resize them endlessly.
246264
247265Eventually when there is a reliable way to get the size and position of a window with its frame on all platforms, then it will be changed. To keep compatibility with older LCL forms, a version number and some extra methods will be added.
248266
249267### I created a Patch to dock the IDE Messages form on the "Source Code Editor" form (at bottom)
250268
251269Such patches will not be applied, because they only implement a small part of the needed docking. The goal is to create a complete dock manager and use that. A complete dock manager can dock all IDE windows and it allows to let the user define how to dock. For example dock the messages window above or below the source editor or ... or not at all. For instance:
252270
253271 +-------------------++--+
254272 |menu || |
255273 +-------------------+| |
256274 +--++---------------+| |
257275 |PI|| Source Editor ||CE|
258276 +--+| || |
259277 +--+| || |
260278 | |+---------------++--+
261279 |OI|+-------------------+
262280 | ||messages |
263281 +--++-------------------+
264282
265283The dock manager can store the layout and restore it on next load. Preferably the dock manager can dock in pages too. The dock manager does not need to use drag and drop. All patches implementing docking without a dock manager makes it harder to implement a real dock manager and will be rejected.
266284
267285### How can I become a developer lazarus and access management in the SVN and bug-tracker?
268286
269287First of all: you must learn about Lazarus, to prove your knowledge and skill. Start by reading the [[Lazarus Documentation|wiki articles]], read the Lazarus source code, giving a look at the [Lazarus Bug-Tracker](http://www.lazarus.freepascal.org/mantis), fix some bugs, and if you think you are ready, contact the developers on the [mailing list](http://www.mail-archive.com/lazarus@miraclec.com).
270288
271289## Where is ... defined
272290
273291### Virtual key constants
274292
275293Virtual key constants are defined in LCLType. Add LCLtype to your uses.
276294
277295## Using the IDE
278296
279297### How can I use "identifier completion"?
280298
281299You can invoke identifier completion by pressing \[ctrl\]\[space\]. Under the menu item *Environment -\> Editor Options -\> Code Tools -\> Automatic Features* you can set how quick this should happen automatically.
282300
283301## Linux
284302
285303### How can I debug on Linux without the IDE?
286304
287305First 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:
288306
289-` $ make clean; make OPT=-dDEBUG`\
290-` $ ddd lazarus`
307+```text
308+ $ make clean; make OPT=-dDEBUG
309+ $ ddd lazarus
310+```
291311
292312Be 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.
293313
294314### I can debug now but ddd does not find my sources or complains that they contain no code. Whats that?
295315
296316This is a path-related problem with either gdb or ddd. You can aviod this by
297317
298318- 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.
299319- In ddd goto \[Edit\] \[gdb-settings\] and set the search-path
300320- Create a \$(HOME)/.gdbinit file like:
301321
302-`     directory /your/path/to/lazarus`\
303-`     directory /your/path/to/lazarus/lcl`\
304-`     directory /your/path/to/lazarus/lcl/include`
322+```text
323+ directory /your/path/to/lazarus
324+ directory /your/path/to/lazarus/lcl
325+ directory /your/path/to/lazarus/lcl/include
326+```
305327
306328### I receive an error during the linking that states /usr/bin/ld can't find -l\<some lib\>
307329
308330**Package Based Distributions**
309331You 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).
310332
311333Some distributions have commands to find which package contains a file:
312334
313335**Mandriva**
314336
315-`[]$ urpmf lib<somelib>.so`
337+```text
338+[]$ urpmf lib<somelib>.so
339+```
316340
317341
318342will list all packages containing the file named lib\<somelib\>.so, you'll have to install those ending in -devel
319343
320344
321345**Debian**
322346
323347
324348install the apt-file utility (apt-get install apt-file) then
325349
326-`[]$ apt-file search lib<somelib>.so`
350+```text
351+[]$ apt-file search lib<somelib>.so
352+```
327353
328354
329355will list all packages containing the file named lib\<somelib\>.so, you'll have to install those ending in -dev
330356
331357**Source Based Distributions and Manual Compilation (LFS)**
332358Make 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).
333359
334360**FreeBSD**
335361As 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) NOTE: This has changed as of late. Newest ports have gtk-12 and glib-12 as well. You might stumble on this problem, since FPC requires the "-less" ones, you will need to symlink them like this:
336362
337-`[]# cd /usr/local/lib && ln -s libglib-12.so libglib12.so`\
338-`[]# cd /usr/X11R6/lib && ln -s libgtk-12.so libgtk12.so`\
339-`[]# cd /usr/X11R6/lib && ln -s libgdk-12.so libgdk12.so`
363+```text
364+[]# cd /usr/local/lib && ln -s libglib-12.so libglib12.so
365+[]# cd /usr/X11R6/lib && ln -s libgtk-12.so libgtk12.so
366+[]# cd /usr/X11R6/lib && ln -s libgdk-12.so libgdk12.so
367+```
340368
341369**NetBSD**
342370As source based distro's, and also make sure you have -Fl/usr/pkg/lib in your fpc.cfg and/or Lazarus library path
343371
344372### How can I convert a kylix 2 project into a lazarus project?
345373
346374Nearly the same way as converting a Kylix project into a Delphi/VCL project.
347375
348376The LCL (Lazarus Component Library) tries to be compatible to Delphis VCL. Kylix CLX tries to be QT compatible. Here are some general hints:
349377
350378- Rename all used CLX Q-units like QForms, QControls, QGraphics, ... into their VCL counterparts: Forms, Controls, Graphics, ...
351379- Add LResources to the uses section of every form source
352380- Rename or copy all .xfm files to .lfm files.
353381- Rename or copy .dpr file to .lpr file.
354382- Add "Interfaces" to the uses section in the .lpr file.
355383- Remove {\$R *.res} directive
356384- Remove {\$R *.xfm} directive
357385- Add {\$mode objfpc}{\$H+} or {\$mode delphi}{\$H+} directive to .pas and .lpr files
358386- Add an initialization section to the end of each form source and add an include directive for the .lrs file (lazarus resource file):
359387
360-` initialization`\
361-`   {$I unit1.lrs}`
388+```text
389+ initialization
390+ {$I unit1.lrs}
391+```
362392
363393
364394The .lrs files can be created via the lazres tool in: (lazarusdir)/tools/lazres.
365395
366396For example: ./lazres unit1.lrs unit1.lfm
367397
368398- Fix the differences. The LCL does not yet support every property of the VCL and the CLX is not fully VCL compatible.
369399
370400- To make it more platform independant, reduce unit libc (which is deprecated) references and substitute with native FPC units like baseunix/unix as much as possible. This will be necessary to support other targets than linux/x86 (including OS X, FreeBSD and Linux/x86_64)
371401
372402### When compiling lazarus the compiler can not find a unit. e.g.: gtkint.pp(17,16) Fatal: Can't find unit GLIB
373403
3744041\. Check a clean rebuild: do a 'make clean all'
375405
3764062\. Check if the compiler has the correct version (2.0.4 or higher)
377407
3784083\. 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.
379409
380410
381411**Hint:** You can see which config file is used with 'ppc386 -vt bogus'
382412
383413Remove any ppc386.cfg as it is really obsolete.
384414
3854154\. Check if the config file (/etc/fpc.cfg) contains the right paths to your fpc libs. There must be three lines like this:
386416
387-`   -Fu/usr/lib/fpc/$fpcversion/units/$fpctarget`\
388-`   -Fu/usr/lib/fpc/$fpcversion/units/$fpctarget/rtl`\
389-`   -Fu/usr/lib/fpc/$fpcversion/units/$fpctarget/*`
417+```text
418+ -Fu/usr/lib/fpc/$fpcversion/units/$fpctarget
419+ -Fu/usr/lib/fpc/$fpcversion/units/$fpctarget/rtl
420+ -Fu/usr/lib/fpc/$fpcversion/units/$fpctarget/*
421+```
390422
391423
392424The first part of these paths (/usr/lib/fpc) depends on your system. On some systems this can be for example /usr/local/lib/fpc/... .
393425
394426**Hint:** You can see your searchpaths with 'ppc386 -vt bogus'
395427
3964285\. Check that the config file (/etc/fpc.cfg) does not contain search paths to the lcl source files (.pp, .pas):
397429
398-` forbidden: -Fu(lazarus_source_directory)/lcl`\
399-` forbidden: -Fu(lazarus_source_directory)/lcl/interfaces/gtk`
430+```text
431+ forbidden: -Fu(lazarus_source_directory)/lcl
432+ forbidden: -Fu(lazarus_source_directory)/lcl/interfaces/gtk
433+```
400434
401435
402436If 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:
403437
404-` -Fu(lazarus_source_directory)/lcl/units/$fpctarget`\
405-` -Fu(lazarus_source_directory)/lcl/units/$fpctarget/gtk`
438+```text
439+ -Fu(lazarus_source_directory)/lcl/units/$fpctarget
440+ -Fu(lazarus_source_directory)/lcl/units/$fpctarget/gtk
441+```
406442
4074436\. 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/\$fpcversion/units/i386-linux/gtk/. If it does not exists, the fpc lib is corrupt and should be reinstalled.
408444
4094457\. 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.
410446
4114478\. If you are still not succeeded try to use samplecfg script as follows:
412448
413449*\#* cd /usr/lib/fpc/*version*/
414450
415451*\#* sudo ./samplecfg /usr/lib/fpc/*\\\$version* /etc
416452
417453Note! Do not put - / - after etc because if you do that the system will create a file - /etc/fpc.cfg/fpc.cfg. In fact we want that samplecfg make a file - /etc/fpc.cfg - not the folder /etc/fpc.cfg.
418454
419455### I have installed the binary version, but when compiling a simple project, lazarus gives: Fatal: Can't find unit CONTROLS
420456
421457Probably 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:
422458
423-` $ bash`\
424-` $ svn checkout `[`http://svn.freepascal.org/svn/lazarus/trunk`](http://svn.freepascal.org/svn/lazarus/trunk)` lazarus`\
425-` $ cd lazarus`\
426-` $ make clean all`
459+```text
460+ $ bash
461+ $ svn checkout http://svn.freepascal.org/svn/lazarus/trunk lazarus
462+ $ cd lazarus
463+ $ make clean all
464+```
427465
428466Make sure that lazarus get the new source directory: Environment-\>General Options-\>Files-\>Lazarus Directory Top
429467
430468### Lazarus compiles, but linking fails with: libgdk-pixbuf not found
431469
432470Install the gdk-pixbuf library for gtk1.x:
433471
434472Where to find the gdk-pixbuf library:
435473
436474RPMs: <http://rpmfind.net/linux/rpm2html/search.php?query=gdk-pixbuf&submit=Search+>...&system=&arch=
437475
438476Debian packages: libgdk-pixbuf-dev
439477
440478Sources: <ftp://ftp.gnome.org/pub/gnome/unstable/sources/gdk-pixbuf/>
441479
442480### I have SuSE and I get /usr/bin/ld: cannot find -lgtk Error: Error while linking
443481
444482SuSE 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).
445483
446484### Lazarus crashes with runtime error 211 after I installed a component
447485
448486After I installed a component, Lazarus crashes with the following message:
449487
450-`Threading has been used before cthreads was initialized.`\
451-`Make cthreads one of the first units in your uses clause.`\
452-`Runtime error 211 at $0066E188`
488+``` pascal
489+Threading has been used before cthreads was initialized.
490+Make cthreads one of the first units in your uses clause.
491+Runtime error 211 at $0066E188
492+```
453493
454494How can I fix this?
455495
456496Your 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:
457497
4584981\) Open the package. In the package editor click on *Options*. Under page *Usage* add to the *custom* options **-dUseCThreads**. Then rebuild the IDE. This way the cthreads unit will be automatically used by the IDE under unix and the cthreads are initialized.
459499
4605002\) In order to avoid modifying package, a fpc compiler option could be used directly. 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.
461501
462502*Hint:* Maybe your old (non-crashing) lazarus executable is stored as lazarus.old in the same directory as the crashing lazarus executable.
463503
464504See also [[Multithreaded Application Tutorial|Multithreaded_Application_Tutorial#Units_needed_for_a_multithreaded_application]]
465505
466506### When I run a program with threads I get runtime error 232
467507
468508The complete error message is:
469509
470-`This binary has no thread support compiled in.`\
471-`Recompile the application with a thread-driver in the program uses`\
472-`clause before other units using thread.`\
473-`Runtime error 232`
510+``` pascal
511+This binary has no thread support compiled in.
512+Recompile the application with a thread-driver in the program uses
513+clause before other units using thread.
514+Runtime error 232
515+```
474516
475517**Solution**: Add cthreads as first unit to the uses clause of your main program, usually the .lpr-file.
476518
477519### I have Ubuntu Breezy and my fonts in Lazarus IDE look too big
478520
479521If 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:
480522
481523 style "default-text" {
482524 fontset = "-*-arial-medium-r-normal--*-100-*-*-*-*-iso8859-1,\
483525 -*-helvetica-medium-r-normal--*-100-*-*-*-*-*-*"
484526 }
485527
486528 class "GtkWidget" style "default-text"
487529
488530If this is not enough try and create also a .gtkrc symlink to .gtkrc.mine . It worked in this way under Xubuntu 7.10.
489531
490532### How can my gtk programs use custom rc files?
491533
492534Option a) Name the rc file *yourprogram.gtkrc* and put it in the same directory where the executable is.
493535
494536Option b) Use unit *GtkInt* and call *GTKWidgetSet.SetRCFilename('your_preferred_rc_file');* Best done before *Application.Initialize* in the .lpr file with *{\$IFDEF LCLGtk}*.
495537
496538### I have Ubuntu and I cannot compile for Gtk2 due to missing libraries
497539
498540Ubuntu has a problem with not creating all the symbolic links that you'll need even when the libraries are installed. Make sure that all missing libraries when trying to link for Gtk2 have their appropriate links. For instance, you might need to do:
499541
500542 cd /usr/lib
501543 sudo ln -s libgdk-x11-2.0.so.0 libgtk-x11-2.0.so
502544
503545Make sure that the \[whatever\].so symbolic links are created and point to the actual libraries.
504546
505547### How can I compile a program for Gtk2?
506548
507549At the moment, the Gtk2 compiled IDE is a little unstable, but you can compile software for Gtk2 using the Gtk1 IDE.
508550
509551To 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.
510552
511553Now click Ok and go to the menu "Tools"-\>"Build Lazarus"
512554
513555Now you can compile your software with Gtk2 going on the Compiler options and changing the widgetset to Gtk2.
514556
515557### I get this message: "\[WARNING\] ** Multibyte character encodings (like UTF8) are not supported at the moment."
516558
517559Since revision 10535 (0.9.21) this message doesn't exist anymore. Previously it was used to warn that a UTF-8 encoding was used. The internal keyhandling routines for the gtk1 widgetset couldn't handle such encoding for keypresses, with the result that keypresses with for instance accented chars were not or wrong detected.
518560
519561(original text for older versions of lazarus)\
520562This warning message indicates that your locale enconding is set to utf-8. If you are using Gtk 1 this can be a serious problem and prevent the correct working of Lazarus or software created with Lazarus.
521563
522564To work around this, just change your locale to a non utf-8 before executing the program on the command line, like this:
523565
524566 export LC_CTYPE="pt_BR"
525567 export LANG="pt_BR"
526568 export LANGUAGE="pt_BR"
527569 ./lazarus
528570
529571Substitute pt_BR with the locale for your country. You can create a script to automate this.
530572
531573## Windows
532574
533575### 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.
534576
535577In the compiler directory there is an OS2 scriptfile named make.cmd. Different versions of Windows also see this as a script file, so remove it since what is needed for OS2 becomes a hindrance on Windows.
536578
537579### When I cycle the compiler, I get: make\[3\]: ./ppc1.exe: Command not found
538580
539581I 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
540582
541583### When I try to make Lazarus I get:
542584
543585#### make.exe: * * * interfaces: No such file or directory (ENOENT). Stop.make.exe: * * * \[interfaces_all\] Error 2
544586
545587You need to upgrade your make.
546588
547589#### makefile:27: *** You need the GNU utils package to use this Makefile. Stop.
548590
549591Make sure you didn't install FPC in a path with spaces in the name. The Makefile doesn't support it.
550592
551593### How can I give my program an XP look like lazarus has?
552594
553595Project -\> Project Options -\> Check 'Use manifest to enables themes'.
554596
555597### When I run Windows program created in Lazarus it starts with a DOS window
556598
557599Specify 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.
558600
559601## Mac OS X
560602
561603### 'unknown section attribute: no_dead_strip'라는 메시지와 함께 프로젝트 컴파일에 실패하는 이유는?
562604
563605죽은 코드(Dead code) 제거 기능이 Xcode 1.5이전의 어셈블러와 링커에서는 지원하지 않습니다(Mac OS X 10.3.9버전에서 사용하는). 다음 컴파일 옵션을 꺼 주세요.
564606
565607- Code \> Unit style \> Smart linkable (-CX)
566608- and Linking \> Link Style \> Link smart (-XX)
567609
568610## Licensing
569611
570612### Can I make commercial applications with Lazarus ?
571613
572614Yes, the LCL is licensed under the LGPL with an exception, which allows you to link to it statically without releasing the source of your application. Modifications and enhancements to the LCL must be distributed with source. Lazarus, the IDE, is licensed under the GPL.
573615
574616### Why are some components restricted from usage in commercial application ?
575617
576618Lazarus comes with additional components, that were developed by third parties. Those are under various other Licenses. If you wish to use them you need to see the License within the source files of those packages. Most of those 3rd party components are in the directory "components".
577619
578620### How do I know if a Component is part of the LCL ?
579621
580622All LCL units are in the directory "lcl". A List of units belonging to the LCL can be found here <http://lazarus-ccr.sourceforge.net/docs/lcl/> . If you code uses units not listed on this page, you may have used a component that is not part of the LCL.
581623
582624### Can I make commercial plug-ins for Lazarus ?
583625
584626Yes, the IDEIntf part of the IDE is licensed under the LGPL with the same exception, so that shared data structures in this part will not force you to license your plug-in or design-time package under the GPL. You are free to choose a plug-in of any license; we don't want to limit your choice. Therefore non-GPL compatible plug-ins are allowed. Note that it's not allowed to distribute a precompiled Lazarus with these non-GPL-compatible plugins included statically; however, we do not see this as a severe limitation, since recompiling Lazarus is easy.
585627
586628## Contributors and Comments
587629
588630This page has been converted from the epikwiki [version](http://lazarus-ccr.sourceforge.net/index.php?wiki=LazarusFaq).
589631
590632---
591633*From the Free Pascal wiki, page "Lazarus Faq/ko", as it stood on 2015-06-06 after a change by FTurtle, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*
592634Category: FAQs/ko
593635Category: Korean
594636Category: Lazarus/ko

Back to history