Recent

Author Topic: "Identifier not found"?  (Read 10187 times)

ferentix

  • Guest
"Identifier not found"?
« on: November 01, 2005, 11:00:18 pm »
First off, I guess HI! My registration e-mail isn't arrived yet, so I'm posting as guest.

Anyways, I'm having a compilation problem. I'm using the Lazarus install that comes with GLScene and Quark pre-installed, and began putting together the example spinning cube program on page 7 of Skinhat's GLScene tutorial. It all compiles and runs fine (The cube is rendered when the program is run) at every stage up until adding the event for progress (OnProgress). Basically, I add that event through the Object Inspector, using the code given in the tutorial:

Code: [Select]
GLCube1.TurnAngle := GLCube1.TurnAngle + deltaTime * 100;

Then try the final compile/run. However, I get the error

Code: [Select]
Identifier not found "GLCube1"


I have checked about a dozen times that this is the exact same name used for the cube in the "Name" property. It is definitely the same... ideas?  :?

Source below:

Code: [Select]

unit Cubespin;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, GLScene,
  GLWin32Viewer, GLCadencer, EditBtn, GLThorFX;

type

  { TForm1 }

  TForm1 = class(TForm)
    GLCadencer1: TGLCadencer;
    GLCamera1: TGLCamera;
    GLLightSource1: TGLLightSource;
    GLScene1: TGLScene;
    GLSceneViewer1: TGLSceneViewer;
    procedure GLCadencer1Progress(Sender: TObject; const deltaTime,
      newTime: Double);
    procedure GLCube1Progress(Sender: TObject; const deltaTime, newTime: Double
      );
    procedure GLThorFXManager1CalcPoint(Sender: TObject; PointNo: integer;
      var x: single; var y: single; var z: single);
  private
    { private declarations }
  public
    { public declarations }
  end;

var
  Form1: TForm1;

implementation

{ TForm1 }

procedure TForm1.GLCadencer1Progress(Sender: TObject; const deltaTime,
  newTime: Double);
begin

end;

procedure TForm1.GLCube1Progress(Sender: TObject; const deltaTime,
  newTime: Double);
begin
  GLCube1.TurnAngle := GLCube1.TurnAngle + deltaTime * 100;
end;

procedure TForm1.GLThorFXManager1CalcPoint(Sender: TObject; PointNo: integer;
  var x: single; var y: single; var z: single);
begin

end;

initialization
  {$I cubespin.lrs}

end.


Oh, I already tried putting "GLCube1: TGLCube;" into the "Type" section (which to be honest was just a stab in the dark). It just tells me "Identifier not found "TGLCube"... which is even more strange, as it doesn't seem to have any problem with "GLCube1" at that point...  :x [/url]

matthijs

  • Hero Member
  • *****
  • Posts: 537
RE: "Identifier not found"?
« Reply #1 on: November 02, 2005, 04:06:11 pm »
You should not put the definition of GLCube1 in the type section but either make it a property of your form or place it in the var section. Then depending on the place you have put it create an instance of it by putting
Code: [Select]

  GLCube1 := TGLCube.Create;

in the OnCreate event of your form or in the initialization section.
Then in the OnDestroy event or the finilazation section you have to free it by putting:
Code: [Select]

  GLCube1.Free;

again the place is depending on the place of your definition of TGLCube.
What's in a sig? Would my posting look less if it didnot have a sig? (Free after William S.) :)

:( Why cannot I upload my own Avatar? :(

Anonymous

  • Guest
RE: "Identifier not found"?
« Reply #2 on: November 02, 2005, 09:08:01 pm »
OK, I'll try that. Thanks :)

ferentix

  • Guest
"Identifier not found"?
« Reply #3 on: November 02, 2005, 10:03:05 pm »
Whoops, sorry, that last post was me...

It still doesn't work! It simply says 'Identifier not found "TGLCube"'... so for some reason it doesn't seem to recognise the TGLCube as a declared type... why could this be? GLScene is definitely in the "Uses" section of the unit... Or are the basic geometry types declared in a different file? The real strange thing is that the cube is rendered perfectly fine without doing this, but if I want to add a line of code referring to it I get the error. For example, the cameras' "target" is "GLCube1" and there is no problem with that, even though I haven't declared GLCube1 in Var or anywhere manually... :shock:

Marc

  • Administrator
  • Hero Member
  • *
  • Posts: 2584
Re: "Identifier not found"?
« Reply #4 on: November 08, 2005, 12:41:33 pm »
Quote from: "ferentix"
First off, I guess HI! My registration e-mail isn't arrived yet, so I'm posting as guest.


If you didn't received a confermatioin email, oyur email is probably blocked/spam filtred. Look at your spamfilters or try a different email account
//--
{$I stdsig.inc}
//-I still can't read someones mind
//-Bugs reported here will be forgotten. Use the bug tracker

suicide0

  • Newbie
  • Posts: 1
Re: "Identifier not found"?
« Reply #5 on: April 12, 2012, 12:57:55 pm »
you have to put "globjects" into to "uses" part
brgds
Sui

 

TinyPortal © 2005-2018