Forum > LCL

[SOLVED]UGH!!! Lost Form1

(1/3) > >>

indydev:
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  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---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  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---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:
This is very difficult to answer. It sounds like an incorrect path.

What happens when you run a simple default Lazarus project?

indydev:
New Application project runs (compiles) just fine.

indydev:
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:

--- Quote from: indydev on September 23, 2021, 02:44:37 am ---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.

--- End quote ---

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.

Navigation

[0] Message Index

[#] Next page

Go to full version