Recent

Author Topic: lazarus structure  (Read 492 times)

crownfield

  • New Member
  • *
  • Posts: 19
lazarus structure
« on: February 16, 2026, 10:10:18 pm »
if I make a new directory
and I create a new application in that directory.
I save all into that directory.
urltest1.frm, urltest1.pas, and urltest.lpr. are there in the new directory, and visible in the code editor

the project begins with

begin   
     bull fucking shit farfo
 
compiler shows no error, so the file in the code editor,
and the file it actually  compiles are not related.
how and why?

why is lazarus compiling anything but the project in the code editor?

the answer to this will clear up a lot, and will make my day.
many thanks for the help and guidance

background
when I compile that the empty program should run, and I should see that empty form. does not happen.

I have a form, and a pascal code file for that form   I want to add those files to the application in theory it would seem that the form and code would be part of that application, and the form should. appear on the screen. it does not seem to happen. how do I make a new program with the form and code. lazarus seems  to not allow that

Bart

  • Hero Member
  • *****
  • Posts: 5706
    • Bart en Mariska's Webstek
Re: lazarus structure
« Reply #1 on: February 16, 2026, 10:26:11 pm »
Well, since that works out of the box for (almost) everybody else, you must either have a faulty installation, or you are doing something wrong.

Here's how it should work:
  • Start Lazarus
  • Project->New Project->Application->OK
  • A new project consiting of an empty form and a unit file in the source editor is created
  • Project->Save as
  • Choose a folder, give the project a name (default is project1.lpi)
  • Give the unit a name (default is unit1.pas)
  • Compile the project
  • Run the project: an emty form should appear
  • Close the project
  • In the IDE: drop a TButton on the form
  • Compile the project
  • Run the project: an otherwise emty form with 1 button should appear
  • Close the program
  • Close Lazarus
  • Restart Lazarus
  • It should load the project you previously made

If this step-by-step does not work for you: something is wrong.

Bart

valdir.marcos

  • Hero Member
  • *****
  • Posts: 1186
Re: lazarus structure
« Reply #2 on: February 16, 2026, 10:30:37 pm »
if I make a new directory
and I create a new application in that directory.
I save all into that directory.
urltest1.frm, urltest1.pas, and urltest.lpr. are there in the new directory, and visible in the code editor

the project begins with

begin   
     bull fucking shit farfo
 
compiler shows no error, so the file in the code editor,
and the file it actually  compiles are not related.
how and why?

why is lazarus compiling anything but the project in the code editor?

the answer to this will clear up a lot, and will make my day.
many thanks for the help and guidance

background
when I compile that the empty program should run, and I should see that empty form. does not happen.

I have a form, and a pascal code file for that form   I want to add those files to the application in theory it would seem that the form and code would be part of that application, and the form should. appear on the screen. it does not seem to happen. how do I make a new program with the form and code. lazarus seems  to not allow that
FPC (Free Pascal Compiler] compiles per file.

Lazarus compiles per project [group of files].

So, before compiling, you need to ADD those files to your current project.

Take a look here:

Lazarus Tutorial
https://wiki.freepascal.org/Lazarus_Tutorial

Lazarus Tutorial Part 2
https://wiki.freepascal.org/Lazarus_Tutorial_Part_2

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 12208
  • Debugger - SynEdit - and more
    • wiki
Re: lazarus structure
« Reply #3 on: February 16, 2026, 10:32:10 pm »
1) Any sym linked folders? Unlikely, but when you really have bad luck you can trick the IDE into getting confused, if you access the same file (different to your case, as you seem to have 2 diff files) via 2 different directories (by using symlinks to one and the same location).

2) Did you do any "Save as"?
Or copy stuff to a new place.
Maybe something went wrong.

Open the Project settings, and go to the "Paths" page. Check if all the path point to the correct places.

Also verify the full path of the unit that you have open in the editor. It is shown in the status bar.

3) Is the unit with the faulty content, in the "project inspector" which should list all files of the project?
When you open it by double click in the project inspector, do you get taken to the existing editor, or do you get a 2nd editor?


crownfield

  • New Member
  • *
  • Posts: 19
Re: lazarus structure
« Reply #4 on: February 17, 2026, 12:28:23 am »


" you need to ADD those files to your current project.."

that was the answer I  was missing. did it, it works,, and I think I understand all the silly mistakes I was missing..

so thanks to all of you who took the time to help me find the way out of my swamp.

 

TinyPortal © 2005-2018