Recent

Author Topic: ide runs older version of my project  (Read 638 times)

cymatics

  • New Member
  • *
  • Posts: 13
ide runs older version of my project
« on: September 12, 2019, 03:44:41 am »
Hi,

I'm new to Lazarus and have started a project with multiple folders for each version as i progress. I use the "project save as" and "save as" for the .pas (forms) files. As i've progressed, i noticed that sometimes the IDE compiles and runs the version of the program i am working on, and most recently, it seems to build but then an older version of my app pops up instead. The sources and forms in hte IDE are the newest version but it is running an older version.

I'm running Lazarus IDE V 2.0.4 on a Windows 7 SP1 64-bit machine.

Does anyone have an idea of what is going on and how to fix this? I've searched on the web and i can't find any mention of this.

Thanks in advance.

lainz

  • Hero Member
  • *****
  • Posts: 3197
    • Lainz
Re: ide runs older version of my project
« Reply #1 on: September 12, 2019, 04:04:34 am »
Hi,

I'm new to Lazarus and have started a project with multiple folders for each version as i progress. I use the "project save as" and "save as" for the .pas (forms) files. As i've progressed, i noticed that sometimes the IDE compiles and runs the version of the program i am working on, and most recently, it seems to build but then an older version of my app pops up instead. The sources and forms in hte IDE are the newest version but it is running an older version.

I'm running Lazarus IDE V 2.0.4 on a Windows 7 SP1 64-bit machine.

Does anyone have an idea of what is going on and how to fix this? I've searched on the web and i can't find any mention of this.

Thanks in advance.

Use version control software instead of writing the project to different folders. Try SVN or GIT.

cymatics

  • New Member
  • *
  • Posts: 13
Re: ide runs older version of my project
« Reply #2 on: September 12, 2019, 04:23:47 am »
Thanks for your quick reply.

But i can't compile and run the latest code i wrote at this point. How do i "reset" the IDE to run the current project i have? I haven't used VCS before. I would like to get this current project version out as soon as possible.

I've tried copying  the original files (.pas) inot a new folder and opening from ther but it is still linking to the much older version of hte project. Thus my question about a "reset"...

Thanks again.

lucamar

  • Hero Member
  • *****
  • Posts: 1982
Re: ide runs older version of my project
« Reply #3 on: September 12, 2019, 05:10:56 am »
Try closing the project ("Project->Close Project") and then click "Open project", navigate to the new folder and (re-)open the newly saved project.

If that still dosn't work, you'll have to take more "heroic" measures: open the project's ".lpi" in a text editor and check whether it's referencing files in an specific folder rather than in none (which means "use the current one").

Check also, though I suposse you've done it, whether the main program file (the .lps) or any of the units "uses" other units in a specific folder, for example something like:
Code: [Select]
uses someunit in 'OldPath/someunit.pas';
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus 2.0.2/2.0.4  - FPC 3.0.4 on:
(K|L)Ubuntu 12..16, Windows XP SP3, various DOSes.

cymatics

  • New Member
  • *
  • Posts: 13
Re: ide runs older version of my project
« Reply #4 on: September 12, 2019, 06:51:00 am »
Thank you. I've tried many things, including what you've suggested and the following:

* Created a new subfolder in the same main directory as all the other versions, then in the current project, saved it using "project as.." to the new folder, as well as the .pas files. But when i build the newly saved project, it reverts to the old project.

* Copied all the project files over to a new folder, shut down Lazarus and reopened the newly saved project from the new folder, but with the same outcome (old project gets built)

* opened project files ( lpi, lps, lpr) files and edited them with Notepad++ to remove references to older projects, but to no avail.

* tried copying only the main .pas files to a new folder, opening with Lazarus as "New project from File...", then went through the painful process of importing all of the libraries i used in my project and recompiling it. In this case, the correct project compiled (as it detected known errors in the code)..but when it runs, the EXE is of a much older file.

It seems that Lazarus saves the project information in a different location from that of the project itself. It remembers project history, even when i try to start fresh and edit out old references in the project XML files. I can view the new code with all the changes in the IDE, but i simply cannot build it. It's quite frustrating.

Are there any other ways to circumvent this behavior and actually get on with my project? I've even tried copying my new project with only hte new files onto another drive, but still with the same results. It's incredible that i cannot build my new project but i can see it and edit it.

Any other ideas would be greatly appreciated.

Thanks again.

af0815

  • Sr. Member
  • ****
  • Posts: 344
Re: ide runs older version of my project
« Reply #5 on: September 12, 2019, 07:06:17 am »
Make a Backup :-)
Go into your projectfolder and look where the exe and the copiled files are stored. Remove ALL files out of the folder lib (in Projectinspector as Path for Libraries declared). Delete the exe
 Go into menu: run->cleanup and build and use all checks activated.
Wait for finish of compiling. Try a test and check if your exe is new build.
regards
Andreas

cymatics

  • New Member
  • *
  • Posts: 13
Re: ide runs older version of my project
« Reply #6 on: September 12, 2019, 07:58:17 am »
Hi, thank you for that suggestion. I haven't gone into the lib folder before, never thought to look there. I'll follow your suggestion and i'll let you know what happens. By the way, i do back up my files, both by copying all the files from the work in progress to a backup folder, as well as making a new project folder each time i want to rev up to the next version. I had always thought that using "Project save as..." and saving all the main .pas folders into that new file, then opening the project form that new file, would do the trick. I guess Lazarus has other ideas abut that...

Thanks again.

cymatics

  • New Member
  • *
  • Posts: 13
Re: ide runs older version of my project
« Reply #7 on: September 12, 2019, 08:37:09 am »
Hi Ianz,

I tried yur suggestions but the IDE is still compiling an older version of hte code. I have tried to find the path for Project Source Directory but i haven't been able to, so far. Would you or anyone else know where the project source path is defined? I'd love to take a look and see if that's the source of the problem.

Still searching for answers and suggestions,

Cheers.

wp

  • Hero Member
  • *****
  • Posts: 6137
Re: ide runs older version of my project
« Reply #8 on: September 12, 2019, 10:13:02 am »
Hard to tell what's wrong...

Does your project have a "flat" struture, i.e. are all source files in the same directory? If not you had to add the individual paths to "Other unit files" in "Project" > "Project Options" > "Compiler Optios". Only use relative paths here, relative to the project folder which is the one which contains the .lpr/.lpi files of the project. If you'd have absolute paths here the compiler would always use the first location, not that of the copied project.

Does the issue happen with another project, too? Begin a new project, add a button to the form, move it to the upper left corner of the form. Save, compile and run; the button should be in the upper left corner of the form.

Copy the entire project directory to a new directory. Load the project from the new location. Drag the button to the lower right corner of the form. Save, compile and run: the button should now be in the lower right corner of the form.

If the button is at the old position (upper left corner) something is very wrong. At first, rename the folder with your user settings so that Lazarus uses default settings. To find the folder go to "View" > "IDE Internals" > "About IDE"; find the folder name in the line "Primary config directory". Close Lazarus before you do the renaming. If default settings do not help, it is probably fastest to reinstall Lazarus.

If the button is at the new position (lower left corner) compare your original project with this one and find out what is different. Look in the "Project options"
Lazarus trunk / fpc 3.0.4 / all 32-bit on Win-10

cymatics

  • New Member
  • *
  • Posts: 13
Re: ide runs older version of my project
« Reply #9 on: September 12, 2019, 06:40:11 pm »
Hi wp,

In regards to your question: yes, it is a flat file structure as described by you, that is how i have traditionally made the file structure. I like to keep each complete version in a separate folder and then make backups on other drives of those folders, since i've lost too many project files over the years by not taking these steps (when it's really late and i'm really tired, i tend to do stupid things and lose work that way...). Painful.

However, i did try to add the individual paths to "Other unit files" in "Project" > "Project Options" > "Compiler Options" but when i open the Compiler Options window, it does not show any paths and it won't allow me to add any paths.

I did go through some of the Lazarus internals files with Notepad++, and deleted any reference to older versions of my project, then reran Lazarus and recompiled again....still the smae result. I'd really like to know why using flat file structures doesn't work. I'd prefer to treat each up version of my project as a completely new project.

I've decided to completely uninstall Lazarus, including registry settings and any dangling files, and reinstall it. It's painful but what other choice do i have? I'll post what the results are after i'm done.

Thanks for your suggestions.


cymatics

  • New Member
  • *
  • Posts: 13
Re: ide runs older version of my project
« Reply #10 on: September 12, 2019, 07:25:25 pm »
I completely uninstalled Lazarus including registry entries, then reinstalled it. I loaded the new project and ran it and...the old program exe popped up!

I then renamed all of the previous version folders and compiled and ran the project and... still showing the old project exe (version 17).

I then deleted the exe file (version 23) in the current working project folder. Compiling / building worked without error. But as soon as i tried to Run the code, i get the error:

"No program file (my project name).exe found".

What's happening here? Anybody have any ideas?

af0815

  • Sr. Member
  • ****
  • Posts: 344
Re: ide runs older version of my project
« Reply #11 on: September 12, 2019, 08:23:21 pm »
check. the path in your projectoptions. after check the run options. you must have a problem with one of the options.
regards
Andreas

lucamar

  • Hero Member
  • *****
  • Posts: 1982
Re: ide runs older version of my project
« Reply #12 on: September 12, 2019, 09:16:01 pm »
Would you or anyone else know where the project source path is defined? I'd love to take a look and see if that's the source of the problem.

All the paths for the application, other than the common ones (fpc, LCL, etc.) and any you may have custom-set globally (as default for all projects), are stored in the LPI file. That's the first stop to check for extraneous paths.

The second and third places are the file environmentoptions.xml, in Lazarus's configuration folder, and fpc.cfg (you might have to use fpc -va to find which and where it's read from).

HTH.
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus 2.0.2/2.0.4  - FPC 3.0.4 on:
(K|L)Ubuntu 12..16, Windows XP SP3, various DOSes.

cymatics

  • New Member
  • *
  • Posts: 13
Re: ide runs older version of my project
« Reply #13 on: September 12, 2019, 11:04:17 pm »
Thank you Andreas and lucamar for your responses.

In order:
* i have checked Project Options and in the Compiler Options window i tried both adding (to the Other unit files" box the built-in template as well as the putting the path to my working project. For the latter, I had to "Import" it, as when i click on the Open Files glyph, the popup window remains unpopulated. However, adding either of htese to the path and then clicking "OK" brings up an error window. See the attachment.

* regarding the Run "Configure Build+Run File": i have tried adding my working directory path to both the Run and Build windows, and then without (default). Since default directory is the current working directory, i didn't expect it to change the behavior of the IDE, and it didn't.

* I have checked the project lpi files with a text editor and found no reference to other directories. I also checked all the XML and cfg files in the Users\...\lazarus/fpc directory and, again, didn't find any reference to older projects of mine. Expected, as it is a new install...

* i tried using fpc -va and got a very long, verbose list which i tried to peruse but didn't see any references to my project directory or files. What should i be searching for?

Before re-installing Lazarus, i first uninstalled it then searched for any leftover file on my drive, including the registry. I deleted these wherever i found them. I then reinstalled Lazarus (same version, 2.0.4) and checked the "delete leftover files" (something like that), and reinstalled all the component packages that i use. On first boot up of the IDE, Lazarus IMMEDIATELY went to my project working directory. How did it find it on the very first run of the IDE?? WHERE is this information being saved? There must be another location that Lazarus keeps this information, but i haven't been able to find it. Is it hidden in the directories? If so, can anyone please tell me where it is so that i can deal with it once and for all?

In any case, if i install a version of my project's EXE into the ew project folder, the IDE seems to be compiling but the old EXE runs. If i delete the old EXE form my working folder, i get the message "No program file ("...my program.EXE" found".

What is causing this behavior? I'm still no closer to understanding it than i was when i first started posting, although i have learned a bit more about the IDE settings.

Still looking for a solution....if anyone has seen this before or understands what's going on, i'd appreciate your input.

Thanks again to lucamar, Andreas and the others that have helped. It's much appreciated.

Cheers




howardpc

  • Hero Member
  • *****
  • Posts: 3096
Re: ide runs older version of my project
« Reply #14 on: September 12, 2019, 11:07:48 pm »
Do you have an antivirus running?