[SOLVED]UGH!!! Lost Form1 lazarus / 31-LCL ---------------------------------------------------------------------- indydev · 2021-09-23 00:22 I have lost Form1 somehow. I have the dreaded project1.lpr(22,35) Error: Identifier not found "Form1" message upon trying to compile. Project1.lpr has the unit containing Form1 (Main) in its uses clause (See line 13): Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i program project1; {$mode objfpc}{$H+} uses  {$IFDEF UNIX}  cthreads,  {$ENDIF}  {$IFDEF HASAMIGA}  athreads,  {$ENDIF}  Interfaces, // this includes the LCL widgetset  Forms, Main, {<--UNIT CONTAINING "Form1"} ColorTypes  { you can add units after this }; {$R *.res} begin  RequireDerivedFormResource:=True;  Application.Scaled:=True;  Application.Initialize;  Application.CreateForm(TForm1, Form1); //<--ERROR  Application.Run;end.                               and the Main.pas unit has Forms in its uses clause: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i unit Main; {$mode objfpc}{$H+} interface uses        Classes, SysUtils, Types, Forms, Controls, Graphics, StdCtrls, Math, XMLRead, DOM, XMLWrite; type   { TForm1 }    TForm1 = class(TForm)        TextArea: TCheckGroup;        Gutter: TCheckGroup;    procedure FormCreate(Sender: TObject);        private           { private declarations }        public           { public declarations }       end; implementation { TForm1 }  const  Foreground = 0;  Background = 1;  HexColor = ['A' .. 'F', 'a' .. 'f', '0' .. '9']; var  Form1: TForm1;  TxtHolder: String[6];  {$R *.lfm} { TForm1 }  procedure TForm1.FormCreate(Sender: TObject);begin      TextArea.Checked[Foreground]:= True;      TextArea.Checked[Background]:= True;      Gutter.Checked[Foreground]:= True;      Gutter.Checked[Background]:= True;end;                                             As far as I can tell, the Main.pas unit has Form1 in all the correct places, and unit "Main" in the right place in the project file, so I am baffled as to what has happened. ---------------------------------------------------------------------- VTwin · 2021-09-23 00:34 This is very difficult to answer. It sounds like an incorrect path. What happens when you run a simple default Lazarus project? ---------------------------------------------------------------------- indydev · 2021-09-23 00:38 New Application project runs (compiles) just fine. ---------------------------------------------------------------------- indydev · 2021-09-23 00:44 I should have added (sorry), that before this, when I switched unit windows, I noticed a brand new implementation section added to the Main unit and empty procedures. I removed all of them leaving all of the regular procedures and implementation section. It was after this, that it could no longer see the Form1. ---------------------------------------------------------------------- VTwin · 2021-09-23 00:50 Quote from: indydev on September 23, 2021, 02:44:37 amI should have added (sorry), that before this, when I switched unit windows, I noticed a brand new implementation section added to the Main unit and empty procedures. I removed all of them leaving all of the regular procedures and implementation section. It was after this, that it could no longer see the Form1. You lost me. What do you mean "switched unit windows"? Deleting the new implementation section was probably a mistake. I can't otherwise understand what you did. ---------------------------------------------------------------------- indydev · 2021-09-23 01:06 I was looking at another "unit" in Lazarus (tabs along the top of the unit window), when I switched back to the "Main" unit that contains Form1 I noticed that all the procedures were empty, but scrolling down, I could see the completed ones below. I deleted the empty procedures and extra implementation section.  I don't know why or how that happened. ---------------------------------------------------------------------- VTwin · 2021-09-23 01:21 No one here has super powers. Your explanation is unclear. Deleting sections created automatically by Lazarus is likely to cause problems. ---------------------------------------------------------------------- indydev · 2021-09-23 01:37 OK. thanks for trying. ---------------------------------------------------------------------- VTwin · 2021-09-23 03:12 Try again with a simple project not deleting anything produced by Lazarus. Someone here can probably help. ---------------------------------------------------------------------- dbannon · 2021-09-23 04:34 Your declaration of Form1 is in the implementation section, it needs to be in the Interface section to be seen by another unit.  So, just move the "var  Form1: TForm1;" bit above the line that says implementation. Davo Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i implementation { TForm1 }  const  Foreground = 0;  Background = 1;  HexColor = ['A' .. 'F', 'a' .. 'f', '0' .. '9']; var  Form1: TForm1;  TxtHolder: String[6]; ---------------------------------------------------------------------- indydev · 2021-09-23 16:52 And so it all makes sense now! When the extra code was mysteriously added I deleted the wrong "implementation." Good grief, it seems so obvious now! Thank you!