Recent

Author Topic: [SOLVED] Compile unit without project  (Read 5588 times)

julkas

  • Guest
Re: Compile unit without project
« Reply #15 on: August 11, 2019, 12:28:26 pm »
Have you tried FP editor?
C:\lazarus\fpc\3.0.4\bin\i386-win32\fp.exe
Dir \lazarus\fpc\3.0.4\bin\i386-win32\  . Now on Win32 Vista Lazarus 2.0.0/FPC 3.0.4
Code: Text  [Select][+][-]
  1. 16/02/2019  03:32 μμ    <DIR>          .
  2. 16/02/2019  03:32 μμ    <DIR>          ..
  3. 07/04/2012  02:39 μμ           599.566 ar.exe
  4. 07/04/2012  02:39 μμ         1.028.110 as.exe
  5. 03/02/2019  02:14 πμ           199.680 bin2obj.exe
  6. 03/02/2019  02:13 πμ           453.632 chmcmd.exe
  7. 03/02/2019  02:13 πμ           254.976 chmls.exe
  8. 03/02/2019  02:14 πμ           666.624 cldrparser.exe
  9. 30/05/2005  09:05 μμ             6.144 cmp.exe
  10. 30/05/2005  09:05 μμ            22.528 cp.exe
  11. 30/05/2005  09:05 μμ            91.136 cpp.exe
  12. 03/02/2019  02:14 πμ            46.080 data2inc.exe
  13. 03/02/2019  02:14 πμ            98.816 delp.exe
  14. 30/05/2005  09:05 μμ            32.768 diff.exe
  15. 09/03/2011  12:17 μμ           689.664 dlltool.exe
  16. 27/05/2006  09:41 μμ             4.286 fp32.ico
  17. 16/02/2019  03:32 μμ             8.165 fpc.cfg
  18. 03/02/2019  02:14 πμ            95.744 fpc.exe
  19. 03/02/2019  02:14 πμ           262.144 fpcjres.exe
  20. 03/02/2019  02:14 πμ           474.624 fpclasschart.exe
  21. 03/02/2019  02:14 πμ           284.160 fpcmake.exe
  22. 03/02/2019  02:14 πμ           221.184 fpcmkcfg.exe
  23. 03/02/2019  02:14 πμ           327.168 fpcres.exe
  24. 03/02/2019  02:14 πμ           184.832 fpcsubst.exe
  25. 03/02/2019  02:14 πμ           838.656 fpdoc.exe
  26. 03/02/2019  02:14 πμ           181.248 fpmc.exe
  27. 03/02/2019  02:14 πμ           891.392 fppkg.exe
  28. 03/02/2019  02:14 πμ           186.880 fprcp.exe
  29. 30/05/2005  09:05 μμ            68.608 gcc.exe
  30. 30/05/2005  09:05 μμ            19.456 gdate.exe
  31. 30/05/2005  09:05 μμ             4.608 gecho.exe
  32. 30/05/2005  09:05 μμ            18.944 ginstall.exe
  33. 21/05/2009  11:36 πμ               388 ginstall.exe.manifest
  34. 30/05/2005  09:05 μμ            13.824 gmkdir.exe
  35. 30/05/2005  09:05 μμ            64.000 grep.exe
  36. 03/02/2019  02:14 πμ           307.200 h2pas.exe
  37. 03/02/2019  02:14 πμ            36.864 h2paspp.exe
  38. 03/02/2019  02:14 πμ           314.368 importtl.exe
  39. 03/02/2019  02:14 πμ           200.704 instantfpc.exe
  40. 07/04/2012  02:39 μμ           838.670 ld.exe
  41. 30/01/2011  09:43 μμ           165.513 libexpat-1.dll
  42. 10/05/2018  12:40 πμ           188.942 make.exe
  43. 03/02/2019  02:14 πμ           470.016 makeskel.exe
  44. 03/02/2019  02:14 πμ             2.248 makeskel.rsj
  45. 03/02/2019  02:14 πμ            39.936 mkarmins.exe
  46. 03/02/2019  02:14 πμ            47.104 mkinsadd.exe
  47. 03/02/2019  02:14 πμ            43.520 mkx86ins.exe
  48. 30/05/2005  09:05 μμ            31.744 mv.exe
  49. 07/04/2012  02:39 μμ           586.766 nm.exe
  50. 07/04/2012  02:39 μμ           726.030 objcopy.exe
  51. 07/04/2012  02:39 μμ         1.092.622 objdump.exe
  52. 03/02/2019  02:14 πμ           370.688 pas2fpm.exe
  53. 03/02/2019  02:14 πμ           413.184 pas2jni.exe
  54. 03/02/2019  02:14 πμ           373.248 pas2ut.exe
  55. 30/05/2005  09:05 μμ            28.160 patch.exe
  56. 21/01/2010  06:23 μμ               388 patch.exe.manifest
  57. 03/02/2019  02:14 πμ           120.832 plex.exe
  58. 03/02/2019  02:14 πμ            47.616 postw32.exe
  59. 03/02/2019  02:14 πμ         2.387.968 ppc386.exe
  60. 03/02/2019  02:14 πμ            40.960 ppdep.exe
  61. 03/02/2019  02:14 πμ           353.280 ppudump.exe
  62. 03/02/2019  02:14 πμ            95.232 ppufiles.exe
  63. 03/02/2019  02:14 πμ           109.568 ppumove.exe
  64. 03/02/2019  02:14 πμ           192.512 ptop.exe
  65. 03/02/2019  02:14 πμ               789 ptop.rsj
  66. 30/05/2005  09:05 μμ             2.560 pwd.exe
  67. 03/02/2019  02:14 πμ           136.192 pyacc.exe
  68. 30/05/2005  09:05 μμ            30.720 rm.exe
  69. 03/02/2019  02:14 πμ            89.600 rmcvsdir.exe
  70. 03/02/2019  02:14 πμ            51.712 rmwait.exe
  71. 03/02/2019  02:14 πμ           345.600 rstconv.exe
  72. 07/04/2012  02:39 μμ           726.030 strip.exe
  73. 03/02/2019  02:14 πμ           250.880 unihelper.exe
  74. 03/02/2019  02:14 πμ           371.200 unitdiff.exe
  75. 30/05/2005  09:05 μμ            41.472 unzip.exe
  76. 01/10/2011  11:34 μμ           662.542 windres.exe
  77. 30/05/2005  09:05 μμ           141.200 windres.h
  78. 25/02/2009  09:36 μμ             1.345 yylex.cod
  79. 25/02/2009  09:36 μμ             4.334 yyparse.cod
  80. 30/05/2005  09:05 μμ            32.256 zip.exe
  81.  

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: Compile unit without project
« Reply #16 on: August 11, 2019, 12:42:01 pm »
Have you tried FP editor?
C:\lazarus\fpc\3.0.4\bin\i386-win32\fp.exe

Lazarus doesn't install FPC's IDE; one has to either build it from the source folder or install a separate FPC.
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9795
  • Debugger - SynEdit - and more
    • wiki
Re: Compile unit without project
« Reply #17 on: August 11, 2019, 12:45:46 pm »
How compile standalone unit without project in Lazarus?
I got message - The project has no main source file.

Afaik "Quick Compile" means to compile without linking (check project (or package) for syntax errors, but do not produce an exe).

You can configure an "external tool" that will call the compiler for the current editor file.

In any case the error message you get is a different issue. It means you somehow messed up your project.
As it was said, Lazarus is project orientated. The IDE will insist that there is always a (valid) project open. You may compile a single file from that project, but you must have a project open.
Many people believe that "FIle" > "Close All" will close the project, but it does not. It closes all source editors. But the project is still open.

The error you got is unusual. Normally the IDE creates a project with a main source file. I am not sure if there is a way to remove this.
The error does however happen, if you open a project that was created or saved by trunk (Lazarus 2.1) in an earlier version of Lazarus. This is because the file format changed. If you use both versions, then 2.1 has a setting to write compatible project files (project options > Miscellaneous: Maximize compatibility lps/lpi)

julkas

  • Guest
Re: Compile unit without project
« Reply #18 on: August 11, 2019, 12:54:03 pm »
Have you tried FP editor?
C:\lazarus\fpc\3.0.4\bin\i386-win32\fp.exe

Lazarus doesn't install FPC's IDE; one has to either build it from the source folder or install a separate FPC.
You mean Windows default install?

julkas

  • Guest
Re: Compile unit without project
« Reply #19 on: August 11, 2019, 12:57:06 pm »
You can configure an "external tool" that will call the compiler for the current editor file.
Can you give me simple example?

PascalDragon

  • Hero Member
  • *****
  • Posts: 5448
  • Compiler Developer
Re: Compile unit without project
« Reply #20 on: August 11, 2019, 01:54:26 pm »
Lazarus can and must support unit compilation without project.
Who have a different opinion?
I have. FPC's compilation speed is fast enough that it doesn't really matter whether I compile the whole program or a single unit (that in turn might depend on other units which will thus be compiled as well if they changed). And if I really need to keep some stuff precompiled then I use a Lazarus package. Also assures that it's recompiled should I change something in there. (Though "Compile package of current unit" instead of doing a complete compilation of the program might be useful, don't know if there is something like that already...)
So no, I'm not missing the ability to compile a single unit from within Lazarus and I also don't agree that it must support it.
Also I don't see Delphi supporting this. At least I couldn't find it in Delphi 10.2.

julkas

  • Guest
Re: Compile unit without project
« Reply #21 on: August 11, 2019, 02:23:50 pm »
Lazarus can and must support unit compilation without project.
Who have a different opinion?
FPC's compilation speed is fast enough that it doesn't really matter whether I compile the whole program or a single unit
My question is not about compiler speed.
Lazarus can and must support unit compilation without project.
Who have a different opinion?
So no, I'm not missing the ability to compile a single unit from within Lazarus and I also don't agree that it must support it.
OK.
Lazarus can and must support unit compilation without project.
Who have a different opinion?
Also I don't see Delphi supporting this. At least I couldn't find it in Delphi 10.2.
Surprise. I don't have Delphi.

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: Compile unit without project
« Reply #22 on: August 11, 2019, 02:44:56 pm »
You mean Windows default install?

Yes, the Windows install doesn't include the text-mode IDE.

In *nixes they are separate packages: a (more or less) standard fpc (and fpc-src) on one hand and Lazarus on the other, so the FPC package *does* include the FP IDE.
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

julkas

  • Guest
Re: Compile unit without project
« Reply #23 on: August 11, 2019, 02:54:17 pm »
You mean Windows default install?

Yes, the Windows install doesn't include the text-mode IDE.

In *nixes they are separate packages: a (more or less) standard fpc (and fpc-src) on one hand and Lazarus on the other, so the FPC package *does* include the FP IDE.
Ya. I remember fp-ide on Linux install ...

Thaddy

  • Hero Member
  • *****
  • Posts: 14221
  • Probably until I exterminate Putin.
Re: Compile unit without project
« Reply #24 on: August 11, 2019, 03:09:28 pm »
You mean Windows default install?

Yes, the Windows install doesn't include the text-mode IDE.

In *nixes they are separate packages: a (more or less) standard fpc (and fpc-src) on one hand and Lazarus on the other, so the FPC package *does* include the FP IDE.

Since when? Because I always have it available. If you build fpc, fp.exe is also built.
Specialize a type, not a var.

Bart

  • Hero Member
  • *****
  • Posts: 5275
    • Bart en Mariska's Webstek
Re: Compile unit without project
« Reply #25 on: August 11, 2019, 03:20:55 pm »
The fpc installer on Windows AFAIK asks if you want to install the fp IDE...

Bart

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: Compile unit without project
« Reply #26 on: August 11, 2019, 03:23:48 pm »
You mean Windows default install?

Yes, the Windows install doesn't include the text-mode IDE.

Since when? Because I always have it available. If you build fpc, fp.exe is also built.

Yes, if you build it. But the standard Lazarus installer (the EXE you download from SF or wherever) does NOT include a compiled text-mode IDE, just as it includes only the bare needed fpc souirces, rather than the full ones..

AFAIR, it has always been so.

The fpc installer on Windows AFAIK asks if you want to install the fp IDE...

The FPC one yes, but the Lazarus one doesn't. And has never done, AFAICT
« Last Edit: August 11, 2019, 03:28:08 pm by lucamar »
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9795
  • Debugger - SynEdit - and more
    • wiki
Re: Compile unit without project
« Reply #27 on: August 11, 2019, 04:28:42 pm »
You can configure an "external tool" that will call the compiler for the current editor file.
Can you give me simple example?
Menu Tools > Configure External Tools
then "add"

It is pretty self explaining, name it, choose the fpc.exe as program, and add params $EdFile()

There may be more an the wiki, not sure, you can give it a search.

julkas

  • Guest
Re: Compile unit without project
« Reply #28 on: August 12, 2019, 09:18:34 am »
You can configure an "external tool" that will call the compiler for the current editor file.
Can you give me simple example?
Menu Tools > Configure External Tools
then "add"

It is pretty self explaining, name it, choose the fpc.exe as program, and add params $EdFile()

There may be more an the wiki, not sure, you can give it a search.
Nice. Works.

Thaddy

  • Hero Member
  • *****
  • Posts: 14221
  • Probably until I exterminate Putin.
Re: Compile unit without project
« Reply #29 on: August 12, 2019, 12:03:13 pm »
Nice. Works.
Well it works, but it does not take into account the compiler settings you configured in the Lazarus IDE.
That may be not what you expect or want. You can also not debug.
Specialize a type, not a var.

 

TinyPortal © 2005-2018