Recent

Author Topic: Adding existing unit to project shows error  (Read 1866 times)

heejit

  • Full Member
  • ***
  • Posts: 245
Adding existing unit to project shows error
« on: October 12, 2018, 08:49:28 pm »
Code: Pascal  [Select][+][-]
  1. Attached : Screenshot
  2.  
  3. Lazarus : 2.1
  4. FPC       : 3.3.1
  5. SVN REVISION : 59293
  6.  

howardpc

  • Hero Member
  • *****
  • Posts: 4144
Re: Adding existing unit to project shows error
« Reply #1 on: October 12, 2018, 10:01:59 pm »
Without sight of the code leading to the conflict it is impossible to say for sure.
However, one likely possibility is creation order mismatch.

The project from which you are importing a gui unit may have initialised gui controls in a different order than the creation order a simple import (without any adaptation) imposes.
Any reference(s) to properties of objects that are not yet created is bound to produce such errors.

heejit

  • Full Member
  • ***
  • Posts: 245
Re: Adding existing unit to project shows error
« Reply #2 on: October 12, 2018, 10:29:12 pm »
following is unit code which I am trying  to add into my project

Code: Pascal  [Select][+][-]
  1. unit unit_gui;
  2.  
  3. {$mode objfpc}{$H+}
  4.  
  5. interface
  6.  
  7. uses
  8.   Classes, SysUtils, Forms;
  9.  
  10. function get_current_exe_path_dir(): string;
  11.  
  12. implementation
  13.  
  14. function get_current_exe_path_dir(): string;
  15. begin
  16.   Result :=  ExtractFileDir(Application.ExeName);
  17. end;
  18.  
  19. end.
  20.  
  21.  



heejit

  • Full Member
  • ***
  • Posts: 245
Re: Adding existing unit to project shows error
« Reply #3 on: October 12, 2018, 10:34:57 pm »
I have added unit-folder to project-unit-path and it is working


 

TinyPortal © 2005-2018