procedure from another unit in delphi shows undeclared identifier -


i can't seem link procedure unit work in main unit's form. tried adding procedure declaration below interface, mentioned in question how run procedure unit? , didn't work. keeps showing [dcc error] main.pas(27): e2003 undeclared identifier: 'sayhi' here codes both units: main.pas:

unit main;  interface  uses   winapi.windows, winapi.messages, system.sysutils, system.variants, system.classes, vcl.graphics,   vcl.controls, vcl.forms, vcl.dialogs, unit2;  type   tform1 = class(tform)     procedure formcreate(sender: tobject);   private     { private declarations }   public     { public declarations }   end;  var   form1: tform1;  implementation  {$r *.dfm}  procedure tform1.formcreate(sender: tobject); begin sayhi(); end;  end. 

and unit2.pas

unit unit2;  interface uses dialogs;  procedure sayhi();  implementation  procedure sayhi(); begin   showmessage('hi'); end;  end. 

here's dpr file project:

program gl;  uses   vcl.forms,   main in 'main.pas' {form1},   unit2 in 'unit2.pas';  {$r *.res}  begin   application.initialize;   application.mainformontaskbar := true;   application.createform(tform1, form1);   application.run; end. 

here main.dfm file:

object form1: tform1   left = 0   top = 0   caption = 'form1'   clientheight = 444   clientwidth = 621   color = clbtnface   font.charset = default_charset   font.color = clwindowtext   font.height = -11   font.name = 'tahoma'   font.style = []   oldcreateorder = false   oncreate = formcreate   pixelsperinch = 96   textheight = 13 end 

i have seen before, , it's related having different version "unit2" being found first.

you have more 1 unit2.dcu or pas on machine.
unit2 being found without "sayhi" being found first.

please check project , delphi global library paths.


Comments

Popular posts from this blog

PHPMotion implementation - URL based videos (Hosted on separate location) -

javascript - Using Windows Media Player as video fallback for video tag -

c# - Unity IoC Lifetime per HttpRequest for UserStore -