Recent

Author Topic: [solved] source changes don't reflect when i run with F9  (Read 830 times)

rodrigoce

  • New member
  • *
  • Posts: 5
[solved] source changes don't reflect when i run with F9
« on: May 02, 2022, 12:48:46 am »
the source changes don't reflect when i run with F9. fisrt i need build with shift + F9. after that works fine.
what could be happning?
« Last Edit: May 15, 2022, 01:11:26 am by rodrigoce »

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1969
  • Former Delphi 1-7, 10.2 user
Re: source changes don't reflect when i run with F9
« Reply #1 on: May 02, 2022, 01:25:56 am »
Does this still happen if you start a completely new project?

[I have had this happen in the past, but it seemed related to the particular project and I was never able to work out the cause or make it able to be repeated.]
Lazarus 2.3, FPC 3.3.1 macOS 12.3.1 x86_64 Xcode 13.4
Lazarus 2.3, FPC 3.3.1 macOS 12.3.1 aarch64 Xcode 13.4

MarkMLl

  • Hero Member
  • *****
  • Posts: 4163
Re: source changes don't reflect when i run with F9
« Reply #2 on: May 02, 2022, 10:26:44 am »
the source changes don't reflect when i run with F9. fisrt i need build with shift + F9. after that works fine.
what could be happning?

What OS? What version of Lazarus? What version of FPC?

Do you have any conditional directives in your source?

Are you using any include files in your source?

If running on "a unix", are any of the files in your project accessed via symlinks?

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

rodrigoce

  • New member
  • *
  • Posts: 5
Re: source changes don't reflect when i run with F9
« Reply #3 on: May 07, 2022, 08:40:59 pm »
trev,

i did a new minimal project and works fine, but pherhaps don't be a good test.

MarkMLl,

Windows 10, Lazarus 2.2.0, FPC 3.2.2.
No conditional directives.
No includes.

As soon, i will try create a new project files and replace the originals ones, for tests proposits.

Awkward

  • Full Member
  • ***
  • Posts: 100
Re: source changes don't reflect when i run with F9
« Reply #4 on: May 07, 2022, 08:59:25 pm »
additionally, check what your changing files are added to project.
We born to save world from bugs and nazies.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 7867
  • Debugger - SynEdit - and more
    • wiki
Re: source changes don't reflect when i run with F9
« Reply #5 on: May 07, 2022, 09:41:57 pm »
The file that does NOT get recompiled....

1) The file is part of your project? Or of a package?

2) The file is listed in the "Project Inspector" as part of the project?

3) The file is in the same folder as all your other project files

3a) Did you make any changes to: Menu > Project > Project Options > Compiler Options > "PATH" ?  (Or added any such option yourself in any other way, by supplying custom fcp options?)

4) Is the code (that is not recompiled) in a function/procedure that is "inlined"?  (Has the "inline" modifier on the procedure declaration)

5) Is the code (that is not recompiled) in a "generic"?

6) Do any of your units have circular references (and if so, is "the file" part of any such circle)?
  "circular references" => UnitA uses UnitB, but UnitB  uses UnitA (UnitB has a uses clause in the implementation section, so it can use UnitA).
  Circle could be more than just 2 units: UnitA uses UnitB, UnitB uses UnitC, UnitC uses ..... UnitX uses UnitA.

Also: What level of Optimization are you using?



If you did set some custom path... Or if the file is in a package => how many ppu with the files name can you find?


E.g.:  The file is called "UnitFoo.pas". You search all your package, project and custom folders, and sub-folders such as ./lib/*/ or ./unit/*/ => how many "UnitFoo.ppu" are there? (including all lowercase "unitfoo.ppu")
« Last Edit: May 07, 2022, 09:50:59 pm by Martin_fr »

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1969
  • Former Delphi 1-7, 10.2 user
Re: source changes don't reflect when i run with F9
« Reply #6 on: May 08, 2022, 12:56:14 am »
OS: macOS
FPC: trunk (before the switch to git)
Lazarus: trunk (before the switch to git)

The file that does NOT get recompiled....

1) The file is part of your project? Or of a package?

unit1.pas, part of the project.

Quote
2) The file is listed in the "Project Inspector" as part of the project?

Yes.

Quote
3) The file is in the same folder as all your other project files

Yes.

Quote
3a) Did you make any changes to: Menu > Project > Project Options > Compiler Options > "PATH" ?  (Or added any such option yourself in any other way, by supplying custom fcp options?)

No.

Quote
4) Is the code (that is not recompiled) in a function/procedure that is "inlined"?  (Has the "inline" modifier on the procedure declaration)

No.

Quote
5) Is the code (that is not recompiled) in a "generic"?

No.

Quote
6) Do any of your units have circular references (and if so, is "the file" part of any such circle)?
  "circular references" => UnitA uses UnitB, but UnitB  uses UnitA (UnitB has a uses clause in the implementation section, so it can use UnitA).
  Circle could be more than just 2 units: UnitA uses UnitB, UnitB uses UnitC, UnitC uses ..... UnitX uses UnitA.

No.

Quote
Also: What level of Optimization are you using?

Default unchanged.

I resolved the issue by cutting and pasting the content of the units into a new project. I spent some time fiddling with the original project and found that if I changed something in the object inspector, then the files would be recompiled, but not if I just changed a unit file. In the end I deleted the faulty project and continued with its copy with no further compilation problems.
Lazarus 2.3, FPC 3.3.1 macOS 12.3.1 x86_64 Xcode 13.4
Lazarus 2.3, FPC 3.3.1 macOS 12.3.1 aarch64 Xcode 13.4

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 7867
  • Debugger - SynEdit - and more
    • wiki
Re: source changes don't reflect when i run with F9
« Reply #7 on: May 08, 2022, 01:30:06 am »

Ok, so that is none of the potential issues I have ever come across.

While I don't know of how much help for that case I can be => if it happens again, check if the file gets saved.
Well that is
- if you saved it yourself => nothing to check
- If you relied on the IDE to save it before compiling => saving vs not saving might be a hint for future investigation.

Also, in such a case:
- keep the "probably broken" project file.
- Ideally backup the entire folder
With some look, some one can reproduce on that backup. (if it can be handed to someone).




@rodrigoce

Here is another idea / might be worth trying.

- backup your entire project first / just in case
- keep working in the current folder / not in the backup
=> do NOT work in the backup folder / do NOT open the project from the backup folder. While it should be ok, if anything is wrong in the lpi file, it may have incorrect paths / affect files that it should not touch.

If you have an lps file (Either in your project folder, or in the "primary config path" subfolder "projectsessions" / menu View > Ide Internals > About Ide => its listed in there)
- while Lazarus is closed: Delete that lps file.
- See if it helps

If you don't have an lps file (depends on your config) / Or if deleting it made no diff:
- while Lazarus is closed: Delete the lpi file of your project (in the project dir).
- Start Lazarus, open the lpr file of your project (you should have exactly one)
- Lazarus should ask if you want to create a project for it => Yes
   -> Then choose the project type (e.g Application if you have an app with TForm)
- Open the project inspector => From the Toolbar: Add > "Add..." => then add all the pas files from your project folder.
- Make any changes you need in "Project Options": Optimization, Target, Debug info, Form to be auto created .... Anything you hand changed yourself in the original project
- Save the project

Now work with that project .

If that helped, send the old and the new lpi file please (and keep the backup folder if more info is needed). You can sent it in private mail.
If it did not help => sorry but it was worth a try.

rodrigoce

  • New member
  • *
  • Posts: 5
Re: source changes don't reflect when i run with F9
« Reply #8 on: May 14, 2022, 03:40:27 pm »
I'm sorry, I was only working on base classes (ancestors) and the issue of not applying changes to files with F9 (Run) happens only to those types of files. Files like Forms are compiling normally with F9 (Run). The question now is why files from which inheritance comes only recompile with Shift + F9 (Build). I tried many of the things you said.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 7867
  • Debugger - SynEdit - and more
    • wiki
Re: source changes don't reflect when i run with F9
« Reply #9 on: May 14, 2022, 04:26:52 pm »
I'm sorry, I was only working on base classes (ancestors) and the issue of not applying changes to files with F9 (Run) happens only to those types of files. Files like Forms are compiling normally with F9 (Run). The question now is why files from which inheritance comes only recompile with Shift + F9 (Build). I tried many of the things you said.

You mean ...

- Form Inheritance / TFrame ?
- Generic types "type generic TFoo<A, B> = class ... end;"
- Or pure old fashion OO inheritance "TFoo = class(TBar) ... end;"

1) TFrame
Changes you made were on the form designer? And the Form that uses the TFrame did not reflect those changes?
(Not sure, but that may be a known issue)

Changes your made where in the pascal sources of the TFrame?

2) "generic"
There is on open bug report. changes to generics in another unit are not always handled.

3) "OO"
This should really work....

rodrigoce

  • New member
  • *
  • Posts: 5
Re: source changes don't reflect when i run with F9
« Reply #10 on: May 15, 2022, 01:08:38 am »
type

  { TDALBase }

  generic TDALBase<T: class> = class
.
.
.

type

  { CustomerDAL }

  TCustomerDAL = class(specialize TDALBase<TCustomerEntity>)
    public 

.
.
.

well, this is a known issue. i think that the question is closed now.

thanks.



Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 7867
  • Debugger - SynEdit - and more
    • wiki

 

TinyPortal © 2005-2018