1fpc(1)                       Free Pascal Compiler                       fpc(1)
2
3
4

NAME

6       fpc - Free Pascal Compiler (FPC) binary
7
8

SYNOPSIS

10       fpc [options] [sourcefile]
11
12

DESCRIPTION

14       This  binary is the main binary of the Free Pascal Compiler (FPC) which
15       is a Turbo Pascal and Delphi (7.0) compatible standalone (non GCC fron‐
16       tend) multitarget Pascal compiler.
17
18       The  compiler  uses  LD(1)  and can use AS(1) (see parameter -Aas), but
19       also has its own binary object writer.
20
21       The current main targets are  Go32V2  (Dos  DJGPP  extender),  Freebsd,
22       Linux, MacOS, MacOSX, MorphOS, Netware, OS/2 and Win32.  The other tar‐
23       gets (M68K compilers for Atari and Amiga) are  either  based  on  older
24       versions of the compiler or are still in development.
25
26       This  manpage is meant for quick-reference only. FPC comes with a great
27       (2000+ pages) manual, which is updated constantly, while this man  page
28       can be out of date.
29
30

Version number

32       Starting  with  release  1.0,  a  new versioning system has been imple‐
33       mented.  If the last number is even (1.0, 1.0.2), it is stable, and  if
34       the  last  number  is  odd  it  is  a  daily  changing development ver‐
35       sion.(1.0.5, 1.1) just like the linux kernel.
36
37       Version 0.99.5 however is a stable release.  It  was  made  before  the
38       even/odd version naming system was introduced.
39
40

Usage

42       The  compilation process is started by typing fpc followed by a source‐
43       file name (normally with .pas or .pp extension). Before processing  the
44       actual processing of the source file, fpc.cfg(5) the configuration file
45       of the compiler is read which contains the location of the  RTL,  other
46       packages  (FCL,  FreeVision),  and  optionally  default values for some
47       switches. See the separate manpage of fpc.cfg(5) for more information.
48
49

Options

51       General options
52
53
54       -h     if you specify this option, the compiler outputs a list  of  all
55              options, and exits after that.
56
57       -?     idem  as  -h,  but  waiting after every screenfull for the enter
58              key.
59
60       -i     This option tells the compiler to print the  copyright  informa‐
61              tion.
62
63              You  can  give  it an option, as -ixxx where "xxx" can be one of
64              the following:
65
66              D      Returns the compiler date.
67
68              V      Returns the compiler version.
69
70              SO     Returns the compiler OS.
71
72              SP     Returns the compiler processor.
73
74              TO     Returns the target OS.
75
76              TP     Returns the target Processor.
77
78       -l     This option tells the compiler to print the FPC logo on standard
79              output. It also gives you the FPC version number.
80
81       -n     Tells the compiler not to read the configuration file fpc.cfg(5)
82
83
84       Options for getting feedback
85
86       -vxxx  Be verbose. "xxx" is a combination of the following:
87
88              e      Tells the compiler to show only errors. This option is on
89                     by default.
90
91              i      Tells the compiler to show some general information.
92
93              w      Tells the compiler to issue warnings.
94
95              n      Tells the compiler to issue notes.
96
97              h      Tells the compiler to issue hints.
98
99              l      Tells the compiler to show the line numbers  as  it  pro‐
100                     cesses a file. Numbers are shown per 100.
101
102              u      Tells  the  compiler  to  print the names of the files it
103                     opens.
104
105              t      Tells the compiler to print the names  of  the  files  it
106                     tries to open.
107
108              p      Tells  the  compiler to print the names of procedures and
109                     functions as it is processing them.
110
111              c      Tells the compiler to warn you when it processes a condi‐
112                     tional.
113
114              m      Tells the compiler to write which macros are defined.
115
116              d      Tells the compiler to write other debugging info.
117
118              a      Tells  the  compiler to write all possible info. (this is
119                     the same as specifying all options)
120
121              0      Tells the compiler to write no messages. This  is  useful
122                     when you want to override the default setting in the con‐
123                     figuration file.
124
125              b      Tells the compiler to show all procedure declarations  if
126                     an overloaded function error occurs.
127
128              x      Tells  the  compiler  to output some executable info (for
129                     Win32 platform only).
130
131              r      Rhide/GCC compatibility mode: formats the  error  differ‐
132                     ently, so they are understood by RHIDE.
133
134       Options concerning files and directories
135
136       -exxx  tells  the  compiler that xxx is the directory where it can find
137              the executables as (the assembler) and ld (the linker).
138
139       -FD    same as -e.
140
141       -Fexxx This option tells the compiler to write errors, etc. to the file
142              xxx
143
144       -FExxx set the executable/unit output path to xxx
145
146       -Fixxx adds xxx to the path where the compiler searches for its include
147              files.
148
149       -Flxxx Adds xxx to the library searching path,  and  is  passe  to  the
150              linker.
151
152       -FLxxx (  Linux  only)  Tells  the  compiler  to use xxx as the dynamic
153              linker.  Default  this   is   /lib/ld-linux.so.2,   or   lib/ld-
154              linux.so.1, depending on which one is found.
155
156       -Foxxx Adds xxx to the object file path. This path is used when looking
157              for files that need to be linked in.
158
159       -Frxxx tells the compiler that  xxx  contains  the  compiler  messages.
160              Default  the  compiler  has  built-in  messages. Specifying this
161              option will override the default messages.  (useful if you  want
162              to use a language other than the default language).
163
164       -Fuxxx Adds  xxx  to  the  unit  path.   By  default, the compiler only
165              searches for units in the current directory  and  the  directory
166              where  the  compiler  itself resides. This option tells the com‐
167              piler also to look in the directory xxx
168
169       -FUxxx Tells the compiler to write units in directory  xxx  instead  of
170              the current directory.
171
172       -Ixxx  Add xxx to the include file search path.  This path is used when
173              looking for include files.
174
175
176       Options controlling the kind of output for more  information  on  these
177       options, see also the programmers manual.
178
179       -a     Tells  the compiler not to delete the assembler file.  This also
180              counts for the (possibly) generated batch script.
181
182       -al    Tells the compiler to include the sourcecode lines in the assem‐
183              bler file as comments.
184
185       -an    Tells  the compiler to include node information in the generated
186              assembler file.  This is mainly for use by the compiler develop‐
187              ers.
188
189       -ap    Tells  the  compiler to use pipes to communicate with the assem‐
190              bler.
191
192       -ar    Tells the compiler to include  register  allocation/deallocation
193              information.
194
195       -at    Tells   the  compiler  to  include  temporary  register  alloca‐
196              tion/deallocation information.
197
198       -Axxx  specifies what kind of assembler should be generated . Here  xxx
199              is one of the following :
200
201              AS     A unix .o (object) file, using GNU AS
202
203              coff   coff object file (go32) using internal writer.
204
205              default
206                     Use the default writer for the current platform.
207
208              elf    elf  object  file  (linux,  32-bit  only)  using internal
209                     writer.
210
211              nasmcoff
212                     a coff file using the nasm assembler.
213
214              nasmelf
215                     a ELF32 file (LINUX only) using the nasm assembler.
216
217              nasmobj
218                     a obj file using the nasm assembler.
219
220              masm   An obj file using the Microsoft masm assembler.
221
222              pecoff pecoff object file (win32) using internal writer.
223
224              tasm   An obj file using the Borland tasm assembler.
225
226              wasm   An obj file using the Watcom assembler.
227
228       -Ccxxx set the default calling convention to XXX.
229
230       -CD    Create dynamic library.
231
232
233       -Ce    Compile using emulated floating point instructions.
234
235       -Cfxxx Set the used floating point instruction set to xxx.
236
237       -Cg    Generate PIC code.
238
239       -Chxxx Reserves xxx bytes heap.  xxx should be between 1024  and
240              67107840.
241
242       -Ci    Generate Input/Output checking code.
243
244       -Cn    Omit the linking stage.
245
246       -Co    Generate Integer overflow checking code.
247
248       -CR    Verify object call validity (method calls mustbe valid).
249
250       -Cr    Generate Range checking code.
251
252       -Csxxx Set stack size to xxx bytes.
253
254       -Ct    generate stack checking code.
255
256       -CX    Create a smartlinked library.
257
258       -dxxx  Define the symbol name xxx This can be used to condition‐
259              ally compile parts of your code.
260
261
262       -E     Same as -Cn.
263
264       -g     Generate debugging information for debugging with GDB
265
266       -gg    idem as -g.
267
268       -gd    generate debugging info for dbx.
269
270       -gh    use the heaptrc unit (see the units part of the FPC  man‐
271              ual).
272
273       -gl    use the lineinfo unit for line information (see the units
274              part of the FPC manual).
275
276       -gv    Generate information for debugging with valgrind.
277
278       -gw    Generate DWARF debugging information.
279
280       -Oxxx  optimize the compiler's output; xxx can have one  of  the
281              following values :
282
283              g      optimize for size, try to generate smaller code.
284
285              G      optimize  for  time,  try  to generate faster code
286                     (default).
287
288              r      keep certain variables in registers (experimental,
289                     use with caution).
290
291              u      uncertain optimizations
292
293              1      Level 1 optimizations (quick optimizations).
294
295              2      Level  2 optimizations (-O1 plus some slower opti‐
296                     mizations).
297
298              3      Level 3 optimizations (-O2 plus -Ou).
299
300              pn     Specify processor : n can be one of
301
302                     1      optimize for 386/486
303
304                     2      optimize for Pentium/PentiumMMX (tm)
305
306                     3      optimizations for PentiumPro / P-II / Cyrix
307                            6x86 / K6 (tm)
308
309              The  exact  effect  of  these effects can be found in the
310              programmers part of the manual.
311
312       -oxxx  Tells the compiler to use xxx as the name of  the  output
313              file (executable). Only with programs.
314
315       -pg    Generate profiler code for gprof.
316
317       -s     Tells  the compiler not to call the assembler and linker.
318              Instead, the compiler writes  a  script,  PPAS.BAT  under
319              DOS,  or  ppas.sh under Linux, which can then be executed
320              to produce an executable.
321
322       -sh    Tells the compiler to generate a script that can be  used
323              to  assemble and link on the host system, not on the tar‐
324              get system. Use this when cross-compiling.
325
326       -sr    Skip register allocation stage in compiler (use with -ar)
327
328       -st    Tells the compiler to generate a script that can be  used
329              to  assemble  and  link  on the target system, not on the
330              host system. Use this when cross-compiling.
331
332       -Txxx  Specifies the target operating system.  xxx can be one of
333              the following:
334
335              EMX    OS/2 and DOS via the EMX extender.
336
337              FREEBSD
338                     FreeBSD
339
340              GO32V2 DOS and version 2 of the DJ DELORIE extender.
341
342              LINUX  Linux.
343
344              NETBSD Netbsd.
345
346              NETWARE
347                     Novell Netware module (clib)
348
349              NETLIBC
350                     Novell Netware module (libc)
351
352              OPENBSD
353                     OpenBSD
354
355              OS2    OS/2 (native mode)
356
357              SunOS  Solaris SunOS
358
359              WATCOM WatCOM dos extender
360
361              WDOSX  WDosX Dos extender
362
363              WIN32  Windows 32 bit.
364
365       -uxxx  undefine  the  symbol  xxx  if it is defined. This is the
366              opposite of the -d option.
367
368       -Xx    Executable options. These tell the compiler what kind  of
369              executable  should  be  generated. the parameter x can be
370              one of the following:
371
372              c      (Linux only, obsolete) Link with  the  C  library.
373                     You  should  only  use this when you start to port
374                     Free Pascal to another operating system.
375
376              D      Link   with   dynamic   libraries   (defines   the
377                     FPC_LINK_DYNAMIC symbol)
378
379              d      Don't use the standard library path. Use this when
380                     cross-compiling, to avoid linking with the host OS
381                     libraries.
382
383              Pxxx   Prepend  the  names of binutils (as, ld) with xxx.
384                     For use when cross-compiling.
385
386              rxxx   Set the library search path to xxx.
387
388              s      Strip the symbols from the executable.
389
390              S      Link   with   static   libraries   (defines    the
391                     FPC_LINK_STATIC symbol)
392
393              t      Link statically (passes -static to the linker)
394
395              X      Link   smart.   Using   this   option   sets   the
396                     FPC_LINK_SMART symbol.
397
398
399       Options concerning  the  sources  (language  options)  for  more
400       information on these options, see also in the Programmers Manual
401
402       -Mmode Specify  the  language mode.  mode can be one of the fol‐
403              lowing:
404
405              delphi Delphi-compatibility mode. This loads  the  objpas
406                     unit, and switches on ansistring mode ( -Sh ).
407
408              fpc    Default mode.
409
410              gpc    GNU pascal mode (does nothing at the moment)
411
412              macpas Mac  pascal  mode.  This loads the macpas unit and
413                     switches on some Mac extensions (mainly macros)
414
415              objfpc Object Pascal mode. This loads the objpas unit.
416
417              tp     Turbo Pascal mode.
418
419       -Rxxx  Specifies what assembler you use in your "asm"  assembler
420              code blocks. Here xxx is one of the following:
421
422              att    Asm blocks contain AT&T assembler.
423
424              intel  Asm blocks contain Intel assembler.
425
426              direct Asm blocks should be copied as-is in the assembler
427                     file.
428
429       -S2    Switch on Delphi 2 extensions.
430
431       -Sa    Generate code for assertions.
432
433       -Sc    Support C-style operators, i.e. *=, +=, /= and -=.
434
435       -Sd    Tries to be Delphi compatible
436
437       -Se    The compiler stops after the first error.  Normally,  the
438              compiler  tries  to  continue  compiling  after an error,
439              until 50 errors are reached, or a fatal error is reached,
440              and  then  it  stops. With this switch, the compiler will
441              stop after the first error.
442
443       -Sg    Support the label and goto commands.
444
445       -Sh    use ansistrings by default.
446
447       -SIxxx Specify the kind of interfaces.  xxx can be  one  of  the
448              following:
449
450              COM    use  COM  interfaces. (all interfaces descend from
451                     IUnknown)
452
453              CORBA  use CORBA interfaces. (no inheritance is supposed)
454
455       -Si    Support C++ style INLINE.
456
457       -Sm    Support C-style macros.
458
459       -So    Try to be Borland TP 7.0 compatible  (no  function  over‐
460              loading etc.).
461
462       -Sp    Try to be GPC (GNU Pascal Compiler) compatible.
463
464       -Ss    The  name of constructors must be "init", and the name of
465              destructors should be "done".
466
467       -St    Allow the "static" keyword in objects.
468
469       -Un    Do not check the unit name. Normally, the  unit  name  is
470              the  same  as the filename. This option allows both to be
471              different.
472
473       -Ur    Create a release unit. This sets a special  flag  in  the
474              unit, causing the compiler not to look for sources.
475
476       -Us    Compile a system unit. This option causes the compiler to
477              define only some very basic types.
478
479

SEE ALSO

481       fpc.cfg(5) ppdep(1) ppudump(1) ppumove(1) ptop(1) h2pas(1) ld(1)
482       as(1)
483
484
485
486Free Pascal                       22 feb 2002                           fpc(1)
Impressum