Recent

Author Topic: What's wrong with my application?  (Read 1002 times)

bourbon

  • New Member
  • *
  • Posts: 22
What's wrong with my application?
« on: January 19, 2026, 08:52:19 pm »
Hello,
I can no longer create a new application. I place a component, and everything works fine. As soon as I add another component, I consistently get an error message.
If I want to make a minor modification to an existing program, for example, renaming a component, I also get this type of error.

Here, I'm creating a new application. I place a button, rename it, and change the caption. Then I click the button to create an event. Everything goes well. I compile, I test, everything works fine. I close the program, I try to add another button, and that's when the error occurs.

Code: Pascal  [Select][+][-]
  1. unit Unit1;
  2.  
  3. {$mode objfpc}{$H+}
  4.  
  5. interface
  6.  
  7. uses
  8.   Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls;
  9.  
  10. type
  11.  
  12.   { TForm1 }
  13.  
  14.   TForm1 = class(TForm)
  15.     Btn_Quitter: TButton;
  16.     procedure Btn_QuitterClick(Sender: TObject);
  17.   private
  18.  
  19.   public
  20.  
  21.   end;
  22.  
  23. var
  24.   Form1: TForm1;
  25.  
  26. implementation
  27.  
  28. {$R *.lfm}
  29.  
  30. { TForm1 }
  31.  
  32. procedure TForm1.Btn_QuitterClick(Sender: TObject);
  33. begin
  34.   Application.Terminate;
  35. end;
  36.  
  37. end.    

Messages displayed

Code: Pascal  [Select][+][-]
  1. Hint: (11030) Start of reading config file /etc/fpc.cfg
  2. Hint: (11031) End of reading config file /etc/fpc.cfg
  3. Free Pascal Compiler version 3.2.2+dfsg-32 [2024/01/05] for x86_64
  4. Copyright (c) 1993-2021 by Florian Klaempfl and others
  5. (1002) Target OS: Linux for x86-64
  6. (3104) Compiling /home/moi/.lazarus/test/project1.lpr
  7. (3104) Compiling unit1.pas
  8. /home/moi/.lazarus/test/unit1.pas(16,32) Hint: (5024) Parameter "Sender" not used
  9. (9022) Compiling resource /home/moi/.lazarus/test/lib/x86_64-linux/project1.or
  10. (9015) Linking /home/moi/.lazarus/test/project1
  11. (1008) 63 lines compiled, 1.6 sec
  12. (1022) 3 hint(s) issued
  13. Codetools, Erreurs : 1
  14. unit1.pas(8,66) Error: unité StdCtrls non trouvée

  Infos Système
  -------------
 Static hostname: rbs459
       Icon name: computer-desktop
         Chassis: desktop 🖥️
      Machine ID: ef146751110343e08300106e1423e14b
         Boot ID: 474c7958d26147499d9278f6ad782f47
Operating System: Linux Mint 22.1                 
          Kernel: Linux 6.8.0-86-generic
    Architecture: x86-64
 Hardware Vendor: ASRock
  Hardware Model: B450 Pro4
Firmware Version: P4.50
   Firmware Date: Wed 2020-11-04
    Firmware Age: 5y 2month 2w 1d                 

  CPU Modèle
  ----------
Nom de modèle :   AMD Ryzen 5 3600 6-Core Processor


andersonscinfo

  • Full Member
  • ***
  • Posts: 156
Re: What's wrong with my application?
« Reply #1 on: January 19, 2026, 08:53:45 pm »
The error you're encountering — `unité StdCtrls non trouvée` — means the Lazarus IDE cannot find the `StdCtrls` unit, which is essential for basic components like `TButton`, `TEdit`, etc.

This usually happens due to one of these reasons:

### 1. **Lazarus Installation Issue**
Your Lazarus installation might be incomplete or corrupted. The `StdCtrls` unit should be part of the standard Lazarus package (`lcl`). Reinstall Lazarus or ensure all packages are properly installed.

**Fix:**
```bash
sudo apt update
sudo apt install --reinstall lazarus
```

If you installed Lazarus from source or a PPA, make sure you compiled/installed the LCL (Lazarus Component Library) correctly.

---

### 2. **Project Configuration / Missing LCL**
Sometimes, the project doesn’t link to the LCL properly.

**Check:**
- Open your project in Lazarus.
- Go to **Project → Project Options → Compiler Options → Packages**.
- Ensure **LCL** is checked under “Used Packages”.

---

### 3. **Corrupted .lfm or .pas File**
If you’re editing component names manually in `.pas` or `.lfm`, you might have accidentally broken the file structure.

**Fix:**
- Close Lazarus.
- Rename or backup your current `unit1.pas` and `unit1.lfm`.
- Create a new project → add a button → save → then try adding another component.

---

### 4. **FPC Config File Issue**
The compiler config file `/etc/fpc.cfg` might be misconfigured or missing paths to the FPC units.

**Check:**
Open `/etc/fpc.cfg` and ensure it includes something like:
```
-Fu/usr/lib/fpc/\$fpcversion/units/\$fpctarget/
-Fu/usr/lib/fpc/\$fpcversion/units/\$fpctarget/*/
```

You can also try creating a local config in your project folder:
```bash
echo "-Fu/usr/lib/fpc/3.2.2/units/x86_64-linux/" > fpc.cfg
```

---

### Quick Test
Create a minimal test project with this code:

```pascal
unit Unit1;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls;

type

  { TForm1 }

  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private

  public

  end;

var
  Form1: TForm1;

implementation

{$R *.lfm}

{ TForm1 }

procedure TForm1.Button1Click(Sender: TObject);
begin
  ShowMessage('Hello from Lazarus!');
end;

end.
```

If this fails, the issue is definitely with your Lazarus/FPC setup.

---

Try reinstalling Lazarus first — it’s the most common fix for this error.

Att.

bourbon

  • New Member
  • *
  • Posts: 22
Re: What's wrong with my application?
« Reply #2 on: January 19, 2026, 09:31:02 pm »
Thank you so much for this quick and well-documented response.

I installed Lazarus via Synaptic on my distribution.
I've already uninstalled and reinstalled it.

I'll do it again to follow your instructions step by step.

Thank you.

bourbon

  • New Member
  • *
  • Posts: 22
Re: What's wrong with my application?
« Reply #3 on: January 19, 2026, 09:50:04 pm »
I tried the first option (reinstall, via the console), and so far it's working fine. :)

This new program is very short and doesn't do anything, but it's a good sign.

Thanks

cdbc

  • Hero Member
  • *****
  • Posts: 2603
    • http://www.cdbc.dk
Re: What's wrong with my application?
« Reply #4 on: January 19, 2026, 10:15:24 pm »
Hi
Your problem is well known among us *nix users, it stems from the fact that, your OS installs programs (incl. Lazarus) in 'root' space, i.e.: a write-protected area...!
Lazarus tries to remedy this, by using "/home/moi/.lazarus/" instead of "usr/lib/lazarus/", when it e.g.: has to recompile itself due to component-install etc...
...Alas, it doesn't always work smoothly and that's what you're experiencing.

The best way, that I've found is to
· uninstall everything FPC & Lazarus related, installed by the OS' repo-
  manager.
· get FpcUpDeluxe from HERE and run it.
· Install FPC version of your choice & Lazarus version of your choice.
· Get yourself a "Cuppa-Joe", sit back and relax, while it installs your
  software.  8-)
FpcUpDeluxe installs Fpc & laz in "/home/moi/a_dir_of_your_choice/".
This means, NO MORE "Can't find xxxComponent..." errors, because you have full rights in your /home/moi/ directory  ;D
I recommend this way of installing... ;)
Regards Benny
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE6/QT6 -> FPC Release -> Lazarus Release &  FPC Main -> Lazarus Main

dseligo

  • Hero Member
  • *****
  • Posts: 1653
Re: What's wrong with my application?
« Reply #5 on: January 20, 2026, 01:48:11 am »
- Go to **Project → Project Options → Compiler Options → Packages**.
- Ensure **LCL** is checked under “Used Packages”.

My Lazarus doesn't have Packages under Compiler options. Is this some AI hallucination?
Project packages are under Project, Project inspector and then under Required packages.

andersonscinfo

  • Full Member
  • ***
  • Posts: 156
Re: What's wrong with my application?
« Reply #6 on: January 20, 2026, 02:12:55 am »
Thank you, that's right.

Att.

cdbc

  • Hero Member
  • *****
  • Posts: 2603
    • http://www.cdbc.dk
Re: What's wrong with my application?
« Reply #7 on: January 20, 2026, 06:41:03 am »
Hi
@dseligo: I'm left with the same feeling... %)
Regards Benny
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE6/QT6 -> FPC Release -> Lazarus Release &  FPC Main -> Lazarus Main

Thaddy

  • Hero Member
  • *****
  • Posts: 18729
  • To Europe: simply sell USA bonds: dollar collapses
Re: What's wrong with my application?
« Reply #8 on: January 20, 2026, 09:49:16 am »
Are these screenshot more enlightening?
Some of the above is sheer nonsense:

File|New|Package

Create your package by adding files you need.
Compile
Install <this is sometimes optional for runtime packages as long as the paths are correct>

In your project that uses it, simply add the package dependency in the project options:
Project|Project Inspector|Add|<your package>

A package is a separate project from the code that uses it.
This is the correct workflow.
« Last Edit: January 20, 2026, 10:04:12 am by Thaddy »
If Europe sells their USA bonds the USD will collapse. Europe can affort that given average state debts. The USA can't affort that. Just an advice...

PascalDragon

  • Hero Member
  • *****
  • Posts: 6311
  • Compiler Developer
Re: What's wrong with my application?
« Reply #9 on: January 20, 2026, 09:41:24 pm »
The error you're encountering — `unité StdCtrls non trouvée` — means the Lazarus IDE cannot find the `StdCtrls` unit, which is essential for basic components like `TButton`, `TEdit`, etc.

The forum does not support MarkDown. Use its BBCodes for formatting.

VisualLab

  • Hero Member
  • *****
  • Posts: 712
Re: What's wrong with my application?
« Reply #10 on: January 21, 2026, 01:04:16 am »
The error you're encountering — `unité StdCtrls non trouvée` — means the Lazarus IDE cannot find the `StdCtrls` unit, which is essential for basic components like `TButton`, `TEdit`, etc.

The forum does not support MarkDown. Use its BBCodes for formatting.

Nothing will come of it, because the way the content is formulated indicates that the replies (signed "andersonscinfo") were sent by some bot (or are pasted into the post from the output of some AI chat).

bourbon

  • New Member
  • *
  • Posts: 22
Re: What's wrong with my application?
« Reply #11 on: January 21, 2026, 09:04:40 pm »
Thank you all for your replies.

I had written that everything was back to normal, but that's not the case. When I reopened my (test) program, the problems started again, with different messages.

Sometimes the Object Inspector even displays empty shapes.

Completely at my wit's end, I formatted a new partition and installed the latest version of Mint (22.2). Then, I installed Lazarus with Synaptic (which I've been doing for a long time), and now I can add/modify the components placed on the shape without any problems.
I don't understand it at the moment, but your valuable advice will enlighten me, I'm sure of it.

Below are some "amusing" images. >:(

 

TinyPortal © 2005-2018