Recent

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

julkas

  • Guest
[SOLVED] Compile unit without project
« on: August 10, 2019, 11:28:33 am »
How compile standalone unit without project in Lazarus?
I got message - The project has no main source file.
« Last Edit: August 12, 2019, 09:21:40 am by julkas »

Thaddy

  • Hero Member
  • *****
  • Posts: 14373
  • Sensorship about opinions does not belong here.
Re: Compile unit without project
« Reply #1 on: August 10, 2019, 11:54:04 am »
From the command line. (Or use Geany)
This bothers me too.
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

julkas

  • Guest
Re: Compile unit without project
« Reply #2 on: August 10, 2019, 01:02:42 pm »
From the command line. (Or use Geany)
This bothers me too.
So what means Compile, Quick Compile in Lazarus menu?
What about Delphi?

BTW - I can compile unit in TP without main program (project) file.
Quote
The Compile | Compile command compiles only the file in the active edit window.
from the Turbo_Pascal_Version_7.0_Users_Guide_1992.pdf
« Last Edit: August 10, 2019, 02:24:02 pm by julkas »

valdir.marcos

  • Hero Member
  • *****
  • Posts: 1106
Re: Compile unit without project
« Reply #3 on: August 10, 2019, 02:24:14 pm »
From the command line. (Or use Geany)
This bothers me too.
So what means Compile, Quick Compile in Lazarus menu?
What about Delphi?
BTW - I can compile unit in TP without main program (project) file.
Lazarus IDE is project centric. It was designed that way.
You need to rethink and reimplement parts of the IDE to be able to open files without a project, or to compile files individually without a project or not related to the opened project.
« Last Edit: August 10, 2019, 02:28:50 pm by valdir.marcos »

julkas

  • Guest
Re: Compile unit without project
« Reply #4 on: August 10, 2019, 02:38:03 pm »
Lazarus IDE is project centric. It was designed that way.
So it's project centric, not Pascal centric (program, unit, library)?

Thaddy

  • Hero Member
  • *****
  • Posts: 14373
  • Sensorship about opinions does not belong here.
Re: Compile unit without project
« Reply #5 on: August 10, 2019, 02:48:31 pm »
Lazarus IDE is project centric. It was designed that way.
You need to rethink and reimplement parts of the IDE to be able to open files without a project, or to compile files individually without a project or not related to the opened project.
Frankly, that will not do. That's why I use Geany for such cases. Btw: Delphi supports it, so why doesn't Lazarus.
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

julkas

  • Guest
Re: Compile unit without project
« Reply #6 on: August 10, 2019, 03:06:51 pm »
Delphi supports it, so why doesn't Lazarus.
Simple logic.

julkas

  • Guest
Re: Compile unit without project
« Reply #7 on: August 10, 2019, 03:24:21 pm »
Lazarus can and must support unit compilation without project.
Who have a different opinion?

Leledumbo

  • Hero Member
  • *****
  • Posts: 8757
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Compile unit without project
« Reply #8 on: August 10, 2019, 11:24:36 pm »
So what means Compile, Quick Compile in Lazarus menu?
https://wiki.lazarus.freepascal.org/index.php/Lazarus_Tutorial#Run
Lazarus IDE is project centric. It was designed that way.
So it's project centric, not Pascal centric (program, unit, library)?

A-a, different realm terms, don't mix it. Yes, the IDE can and have had support for projects written in other languages, but just as a text editor and project manager, probably with a little compiler integration and autocomplete support, everything else like the drag n drop functionality still only supports Pascal.
Lazarus can and must support unit compilation without project.
Who have a different opinion?
I'm not against nor support it. Good if it's there, but no problem if it's not there.
What's the occassion that you just want to compile a unit? Chance are, you compile it to use it somewhere, possibly in a program, which is managed by a project. BINGO! I guess that's how the project centric POV was born.

valdir.marcos

  • Hero Member
  • *****
  • Posts: 1106
Re: Compile unit without project
« Reply #9 on: August 11, 2019, 09:09:19 am »
Lazarus IDE is project centric. It was designed that way.
You need to rethink and reimplement parts of the IDE to be able to open files without a project, or to compile files individually without a project or not related to the opened project.
Frankly, that will not do. That's why I use Geany for such cases. Btw: Delphi supports it, so why doesn't Lazarus.
This is a Delphi's feature the community miss and complains about since 2005* and maybe even before.
I don't like this Lazarus' feature, but it doesn't bother me.
As a matter of fact, this is one of the rare cases where I think Lazarus should be similiar to Delphi instead of better.
I see, at least, two big problems here:
- People coming from Borland, Inprise, CodeGear, Embarcadero, Idera's products expect an intuitive behavior that doesn't exist on Lazarus and get lost for some time.
- Lazarus project lacks on manpower to study the case and provide a big patch to implement a solution. And once ready, that big patch could never be accepted because of its huge impact on IDE's source code...
So, I can't see any solution in a near future.


Lazarus 1.8.4 IDE/editor problems
https://forum.lazarus.freepascal.org/index.php/topic,44638.msg313983.html#msg313983

(1) "Close all" only closes, the (unit or text) files. The project stays open.

In Lazarus you always have to have a project open. (It just was designed that way a very long time ago, and to change it now would require rewrite of large parts of the IDE)

You can close the project from the project menu. But it will force you to open another project immediately (or close the IDE).

(2) Hence when you start Lazarus, either the last project can be re-opened, or an empty project has to be open.

(3) If you did "close all files" then the IDE may remember that no editor was open, so it will start a new project like this.
If you close a project with it's files open in the editor, then next time you open that project you should see editors right away.

(4) Not sure about 1.8.4, but in 2.0.0 (some of) those colors can be set.
On the color page for the editor, scroll down the tree with the color-elements. There is a section "Identifier Completion"


Compile LCL issue / error
https://forum.lazarus.freepascal.org/index.php/topic,29034.msg182687.html#msg182687

But, I'm not sure that it isn't related to the fact that I tried to compile "Transmission Remote GUI" before that, even tho' I did a "Close All" before trying the LCL Build.  Lazarus seems to "hold over" stuff from the previous project that was loaded.
No, File -> "Close All" does not close the project. It only closes files. That's why it is in Files menu. You still have the same project open.
The current project is closed when you open another project or create a new one. You can also do Project -> "Close Project" but then the IDE is not usable. That is because the session info is part of a project.

Having a project open always is a common complaint from new users. I believe you will complain about the same thing. :)
However it is a non-issue because the project can be a "virtual" project which is not saved anywhere. You can even run a virtual project, then it is automatically saved in a temp dir.

See the Project menu for project related actions, especially look at the project options.


lazarus GUI like Delphi 7 to 100%
https://forum.lazarus.freepascal.org/index.php?topic=22743.15

However you are not a new user. In what situation you need to explicitly close a project?
I have understood that a long time ago there was no dialog but it was added because many people wanted it.
I do close projects from time to time (though indeed rate). Typically if I make to many "recent files/project" jumps and I'm unsure about the project I have opened.

Speaking of history. Originally IDE didn't have many features out-side of the project scope. That's why there was not an option to close one.

Right now IDE has many options that could be addressed without having a project opened:
* packages (installation/removal);
* configuration of IDE itself and/or packages;
* some other tools in the system;

If I need to change FPC version or directory or select a new package to be installed, why would I have to click "New Project" -> "Application"? (just from the usability point of view?).

I'm tend to right all sorts of IDE extensions, as you know ;)
And IDE extension package cannot be a part of any project (as it doesn't really make sense), so I actually have to have something opened to continue editing the package.

IDE does allow to have a project opened without any source files opened.
So isn't it consistent to have IDE opened without any project opened?



* 2005: close projekt
https://forum.lazarus.freepascal.org/index.php?topic=807.0

2005: How about a Menuitem "Close Project" ?
https://forum.lazarus.freepascal.org/index.php?topic=1310.0

2006: How to close a project?
https://forum.lazarus.freepascal.org/index.php?topic=1850.0

2006: Closing a project.
https://forum.lazarus.freepascal.org/index.php/topic,2958.msg13597.html#msg13597

2008: 0012633: saves project file on Quit even after Close All Editor Files
https://bugs.freepascal.org/view.php?id=12633

2010: i can't close my program
https://forum.lazarus.freepascal.org/index.php?topic=10185.0

2015: Lazarus Release Candidate 1 of 1.4
https://forum.lazarus.freepascal.org/index.php/topic,27412.msg169569.html#msg169569

2015: Lazarus vs FPC
https://forum.lazarus.freepascal.org/index.php/topic,30347.msg193088.html#msg193088

2016: [SOLVED] Saved projects won't load
https://forum.lazarus.freepascal.org/index.php?topic=34004.0

2017: Lazarus Release Canditate 1 of 1.8
https://forum.lazarus.freepascal.org/index.php/topic,36907.msg246825.html#msg246825

2019: Source Editor not displaying
https://forum.lazarus.freepascal.org/index.php/topic,16715.msg307010.html#msg307010

valdir.marcos

  • Hero Member
  • *****
  • Posts: 1106
Re: Compile unit without project
« Reply #10 on: August 11, 2019, 09:14:38 am »
Delphi supports it, so why doesn't Lazarus.
Simple logic.
It's not that simple.
I myself think that Lazarus is much important that just being a Delphi's clone... Lazarus should be better than Delphi.

valdir.marcos

  • Hero Member
  • *****
  • Posts: 1106
Re: Compile unit without project
« Reply #11 on: August 11, 2019, 09:18:27 am »
Lazarus can and must support unit compilation without project.
Who have a different opinion?
Feel free to provide a patch and request the reopenig of bug report 12633:
0012633: saves project file on Quit even after Close All Editor Files
https://bugs.freepascal.org/view.php?id=12633

valdir.marcos

  • Hero Member
  • *****
  • Posts: 1106
Re: Compile unit without project
« Reply #12 on: August 11, 2019, 09:35:24 am »
Lazarus can and must support unit compilation without project.
Who have a different opinion?
You should avoid strong words as must on voluntary open source projects...

Lazarus can and must support unit compilation without project.
Who have a different opinion?
I'm not against nor support it. Good if it's there, but no problem if it's not there.
I tend to agree with you.

Quote
What's the occassion that you just want to compile a unit? Chance are, you compile it to use it somewhere, possibly in a program, which is managed by a project. BINGO! I guess that's how the project centric POV was born.
I'll just cite skalogryz's information:

However you are not a new user. In what situation you need to explicitly close a project?
I have understood that a long time ago there was no dialog but it was added because many people wanted it.
I do close projects from time to time (though indeed rate). Typically if I make to many "recent files/project" jumps and I'm unsure about the project I have opened.

Speaking of history. Originally IDE didn't have many features out-side of the project scope. That's why there was not an option to close one.

Right now IDE has many options that could be addressed without having a project opened:
* packages (installation/removal);
* configuration of IDE itself and/or packages;
* some other tools in the system;

If I need to change FPC version or directory or select a new package to be installed, why would I have to click "New Project" -> "Application"? (just from the usability point of view?).

I'm tend to right all sorts of IDE extensions, as you know ;)
And IDE extension package cannot be a part of any project (as it doesn't really make sense), so I actually have to have something opened to continue editing the package.

IDE does allow to have a project opened without any source files opened.
So isn't it consistent to have IDE opened without any project opened?

julkas

  • Guest
Re: Compile unit without project
« Reply #13 on: August 11, 2019, 10:58:09 am »
Quote
You should avoid strong words as must on voluntary open source projects...
OK. May be my mistake.
I am Free Pascal beginner (some experience with TP7).
Quote
Turbo Pascal gives you several ways to create an executable
program or unit. You can
• Compile the current file with (Compile | Compile)
• Compile all changed files (Compile | Make)
• Compile all files in your project (Compile | Build)
• Compile and run your program (Run | Run)
Each of these options is suitable for a particular situation.

valdir.marcos

  • Hero Member
  • *****
  • Posts: 1106
Re: Compile unit without project
« Reply #14 on: August 11, 2019, 12:12:03 pm »
Quote
You should avoid strong words as must on voluntary open source projects...
OK. May be my mistake.
I am Free Pascal beginner (some experience with TP7).
Quote
Turbo Pascal gives you several ways to create an executable
program or unit. You can
• Compile the current file with (Compile | Compile)
• Compile all changed files (Compile | Make)
• Compile all files in your project (Compile | Build)
• Compile and run your program (Run | Run)
Each of these options is suitable for a particular situation.
Have you tried FP editor?
C:\lazarus\fpc\3.0.4\bin\i386-win32\fp.exe

 

TinyPortal © 2005-2018