Recent

Author Topic: Compiled exe not running  (Read 5325 times)

Davidous

  • Full Member
  • ***
  • Posts: 107
Compiled exe not running
« on: March 04, 2022, 09:06:41 am »
Hello All,

after a while I would need a little help again.
I have a program that I made with Lazarus 2.0.8. There are TACharts in it. Everything was OK, I could compile the program and run the exe just fine.
Yesterday I updated to Lazarus 2.2.0 x64. The program compiles OK, but the compiled exe does not run...
Have anyone ever experienced something like this?

Thank you in advance!

Best regards,

David

WooBean

  • Sr. Member
  • ****
  • Posts: 303
Re: Compiled exe not running
« Reply #1 on: March 04, 2022, 09:26:05 am »
Hi,
were you able to compile and run any "Hello world" type program?
Anyway, say more about your OS. It may be UAC or antivirus setting issue or Lazarus invalid configuration.
« Last Edit: March 04, 2022, 09:37:36 am by WooBean »
Platforms: Win7/64, Linux Mint 22.1 Xia

Davidous

  • Full Member
  • ***
  • Posts: 107
Re: Compiled exe not running
« Reply #2 on: March 04, 2022, 09:59:05 am »
Hi,

Hello World works.
I have win 10 64 bit on my computer.
The interesting thing is, that with Lazarus 2.0.8 everything worked fine.
I updated, because Lazarus 2.2.0 has LimitToExtent property for zooming chart, but now I am not able to use the program at all. I have no idea what to do... :(

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12771
  • FPC developer.
Re: Compiled exe not running
« Reply #3 on: March 04, 2022, 10:33:06 am »
What happens when trying to run the exe  ?

Security software is my first bet too. A missing DLL a second. (is this the same machine that 2.0.8 ran on?)



dseligo

  • Hero Member
  • *****
  • Posts: 1682
Re: Compiled exe not running
« Reply #4 on: March 04, 2022, 11:01:05 am »
I have no idea what to do... :(

Try debugging line by line and see where it stops.

Davidous

  • Full Member
  • ***
  • Posts: 107
Re: Compiled exe not running
« Reply #5 on: March 04, 2022, 11:53:38 am »
I tried to run it before. There were many cases, when a window flashed in and disappeared in the same moment.

Now it says "[HKb.YGraphToImage]: Image-graph scaling not yet initialized." HKb is a TAChart. I have more charts on a Form and at FormCreate I want to position them under one another. Earlier it worked.

wp

  • Hero Member
  • *****
  • Posts: 13486
Re: Compiled exe not running
« Reply #6 on: March 04, 2022, 01:08:49 pm »
I tried to run it before. There were many cases, when a window flashed in and disappeared in the same moment.

Now it says "[HKb.YGraphToImage]: Image-graph scaling not yet initialized." HKb is a TAChart. I have more charts on a Form and at FormCreate I want to position them under one another. Earlier it worked.
Without knowing what you are doing I guess that you are accessing some chart properties or methods too early. The chart usually must be painted so that the scaling coefficients are known. An  exception displaying the message that you mentioned was introduced about 2 years ago, i.e. before Laz 2.2.0, to notify of such a situation which can result in hard-to-predict errors. I have no idea why the exception message window is not persistent.

Reorganize your code and move the critical parts to later events, such as OnActivate or OnShow. Or, alternatively, call Chart.Prepare after the charts have been set up and before calling the critical part which raises the exception. Sorry, I cannot be more specific because I don't know your code.

Davidous

  • Full Member
  • ***
  • Posts: 107
Re: Compiled exe not running
« Reply #7 on: March 04, 2022, 05:17:27 pm »
Thank you wp!
The Chart.Prepare thing solved the problem.

However the charts look entirely different then with Lazarus 2.0.8.
On picture 1 you can see how the charts should look like. So far I had no problems with this.
You can see on picture 2 how they look like when I run the compiled exe.

wp

  • Hero Member
  • *****
  • Posts: 13486
Re: Compiled exe not running
« Reply #8 on: March 04, 2022, 05:49:46 pm »
However the charts look entirely different then with Lazarus 2.0.8.
Then still something is wrong. Without sources I cannot help you. Please remove everything which is not needed from the project (make a backup copy first, of course), and upload the .pas, .lfm, .lpr, .lpi and maybe a data file, packaged to a single zip, to the forum.

Davidous

  • Full Member
  • ***
  • Posts: 107
Re: Compiled exe not running
« Reply #9 on: March 04, 2022, 07:01:06 pm »
Sorry, I cannot do that because it is a very complex project, that I made for the company where I work.
Please answer one more question:

I see, that there are many notes next to the lines that should do the formatting of the charts: Call to subroutine "..." marked as inline is not inlined.
Can this cause the problem? What does this mean?

Thaddy

  • Hero Member
  • *****
  • Posts: 18968
  • Glad to be alive.
Re: Compiled exe not running
« Reply #10 on: March 04, 2022, 07:04:23 pm »
No that message can not cause the problem. It means just that the code can not be inlined. For normal code this is harmless.
Inlining code is just speed (a bit)
If you are REALLY sure your code works on one machine and not on others then it is simply a dependency issue.
« Last Edit: March 04, 2022, 07:08:36 pm by Thaddy »
Recovered from removal of tumor in tongue following tongue reconstruction with a part from my leg.

Josh

  • Hero Member
  • *****
  • Posts: 1455
Re: Compiled exe not running
« Reply #11 on: March 04, 2022, 07:13:08 pm »
hi

try moving all your code you have in youf form.oncreate event to a seperate procedure ie. DoThisCodeFirst, then comment out your existing code in the oncreate event, now call the DoThisCodefirst in your on activate event; using a global var to stop calling it twice.

Code: Pascal  [Select][+][-]
  1. type
  2.  
  3.   { TForm1 }
  4.  
  5.   TForm1 = class(TForm)
  6.     procedure FormActivate(Sender: TObject);
  7.     procedure FormCreate(Sender: TObject);
  8.   private
  9.  
  10.   public
  11.     procedure DoThisCodeFirst;
  12.   end;
  13.  
  14. var
  15.   Form1: TForm1;
  16.   FActivated:Boolean=false;
  17.  
  18. implementation
  19.  
  20. {$R *.lfm}
  21.  
  22. { TForm1 }
  23.  
  24. procedure Tform1.DoThisCodeFirst;
  25. begin
  26.   if not FActivated then
  27.   begin
  28.     Factivated:=True;
  29.     // all code from oncreate event
  30.     .....
  31.     .....
  32.  
  33.   end;
  34. end;
  35.  
  36. procedure TForm1.FormActivate(Sender: TObject);
  37. begin
  38.   DoThisCodeFirst;
  39. end;
  40.  
  41. procedure TForm1.FormCreate(Sender: TObject);
  42. begin
  43.    // Comment out all code
  44.    {
  45.    .......
  46.    ......
  47.    }
  48. end;
  49.  
The best way to get accurate information on the forum is to post something wrong and wait for corrections.

wp

  • Hero Member
  • *****
  • Posts: 13486
Re: Compiled exe not running
« Reply #12 on: March 04, 2022, 07:13:44 pm »
Sorry, I cannot do that because it is a very complex project, that I made for the company where I work.
No, I don't need the full project. Only the form with the charts. Fill the chart with dummy data (y = x, or similar). Remove all the calculations that you do for your company or replace them by some trivial stuff. Rename all identifiers that exhibit anything related to your company to some neutral ones. Remove all controls not related to the chart problem. Make sure that the issue still exists with that stripped-down project.

I know that this will take some time, but without any code I cannot help you.

Davidous

  • Full Member
  • ***
  • Posts: 107
Re: Compiled exe not running
« Reply #13 on: March 04, 2022, 08:21:40 pm »
I managed to make a skeleton version of the project.
There are some buttons left but they don't do anything.
If you compile the project and open it, you will see that the charts look not the same as they were designed...

Thank you for  checking it! ;)

wp

  • Hero Member
  • *****
  • Posts: 13486
Re: Compiled exe not running
« Reply #14 on: March 04, 2022, 08:53:00 pm »
If you compile the project and open it, you will see that the charts look not the same as they were designed...
To me the charts look the same as in design mode and exactly like in your screenshot 1.jpg posted above. And when I remove all the chart.Prepare lines I still do not get the crash that you report, and the charts do not change in this case either. So, something is wrong with the demo.

BTW, why do you overlay the charts in such a strange way? For example you could put four charts into a panel and distribute the charts evenly within the panel by using the ChildSizing properties of the panel.

 

TinyPortal © 2005-2018