Recent

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

cymatics

  • New Member
  • *
  • Posts: 13
Re: ide runs older version of my project
« Reply #15 on: September 12, 2019, 11:14:23 pm »
Thank you for the reply. Yes but it was always running before when i was developing hte earlier versions.

cymatics

  • New Member
  • *
  • Posts: 13
Re: ide runs older version of my project
« Reply #16 on: September 12, 2019, 11:21:25 pm »
wp,

I forgot to mention that i built a  simple project as you had suggested. Both projects work well, no issues.

I would start from scratch on this project (ie: using New Project) but the forms are quite complicated, so i am first trying to see if i can import the existing forms and build a new project around them.

Do you, or does anyone, know what the best way to go abut this is?

Thanks again in advance for any help.


wp

  • Hero Member
  • *****
  • Posts: 11854
Re: ide runs older version of my project
« Reply #17 on: September 12, 2019, 11:50:54 pm »
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?
This indicates that you probably installed the new Lazarus version but kept the old config settings - which may not be optimal.

Where is the config folder, i.e. where did Lazarus get this information from?

In Lazarus, go to "View" > "IDE Internals" > "About IDE". The highlighted line in the attached screenshot shows the folder which contains all the configuration files. Close the IDE and delete this folder (or rename it to keep a backup) - next time when Lazarus starts it does not find its configs and silently creates default settings. The bad thing: you must restore all your settings manually again and reinstall all packages. For a test I'd only install the packages which are needed for your project immediately - nothing else, there is a risk that you do the same misconfiguration error again and again.

When the issue still occurs afterward:
Ideally you should try to remove everything unnecessary from your project and post the rest so that we can have look. But maybe it is sufficient to look only at the lpi file because this is where I would expect the error to be. Can you pack the lpi into a zip and upload it this way here?

cymatics

  • New Member
  • *
  • Posts: 13
Re: ide runs older version of my project
« Reply #18 on: September 13, 2019, 12:23:13 am »
Hi wp,

Thank you for the detailed explanation. I must have inadvertently missed the config settings, not sure how. I attached my "View IDE" results here. Also, i have only been installing the packages i need, as you suggested.

I am currently trying to build and run a project using only the .pas files of my original., giving the project a different name. I have reinstalled the necessary ("uses") components for the project. Now when i compile / bild and run, my main window doesn't open but the IDE says it is running. This is a new wrinkle.

I'm going to try a couple of more things and if nothing works, i will do as you suggest. I am also attaching the lpi file here for you.

Thanks again!





cymatics

  • New Member
  • *
  • Posts: 13
Re: ide runs older version of my project
« Reply #19 on: September 13, 2019, 12:59:52 am »
I finally managed to get the project running again. It required the following:

* Copy only the .pas and .lfm files of my project to a new blank directory
* start a new project in the IDE and in Project inspector, load the .pas files as well as the required units
* modifying the .lpr file to include Application.CreateForm(..) for each of the forms since they these lines weren't included in using the IDE tools

Now it seems to be back on track and building and running hte correct file.

A big "Thank you!" to those who helped. It got me t exploring and finding out finally what was not working.

Cheers.

wp

  • Hero Member
  • *****
  • Posts: 11854
Re: ide runs older version of my project
« Reply #20 on: September 13, 2019, 01:09:43 am »
Nice that you got it working. Can you copy this regenerated project now?

But there are some things which I don't understand. Why can't you copy the .lpi and .lpr files? Why do you have to add Application.Createform manually?

Thanks for the lpi file - it looks normal (except for the many packages - do you really need all of them?). Could you also provide a zipped version of the lpr file (which matches the version of the lpi that you already have uploaded, i.e. the old non-working version)? I should already have requested it in the first place.

cymatics

  • New Member
  • *
  • Posts: 13
Re: ide runs older version of my project
« Reply #21 on: September 17, 2019, 07:47:04 am »
Hi wp,

Apologies for the tardy reply. Been getting some last minute things ready for an imminent trip.

At this moment i can only give you a quick reply.

I did originally copy the lip and lpr files but that didn't work. I'm sure where i went wrong, after simply doing project "save as.."  in another folder, Lazarus wouldn't run the project and kept giving me errors (sorry, i don;t remember which at that time). I ended up editing files looking for the cause and i could never get it right (ie: project wouldn't compile as a new project, always falling back to the old project). Finally, i created a new folder for th e updated project, went tothe original folder and did "project save as..." to the new folder, saved the .pas files o the new folder under different names, and used the project inspector to add the new .pas files to the  new project. I had to also modify the .lpr file to insert the missing non-primary forms (dialogs) since they were missing. All in all, it was obviously a series of my own screw-ups that garbled the project files, since this was the first Lazarus project i have worked on and i am still unfamiliar with the IDE tools.

In short: culpa mia est...

I am leaving day after tomorrow, so i will have to wait until i get back to see if i can send you the old files you requested.

Thanks very much again. Your help is really appreciated.


lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: ide runs older version of my project
« Reply #22 on: September 17, 2019, 03:50:27 pm »
For future reference, you didn't need to add the "CreateForm", etc. by hand; after copying the .lfm/.pas files to the new folder and creating the new project, you can either open the "Project Inspector" (menu "Project") and use "Add Files from File Sytem", or use "File -> Open" to open the .lfm/.pas and then, in the "Project Inspector", use "Add editor files" to add them.

This last can also be done by typing "Shift+F11" in the editor, to add a single, currently opened unit/form.

After adding all the forms/units, open "Project Options", go to "Forms" and set which should be "auto-created".

It sounds like more work when written than it really is in practice, and it has the advantage that you don't run the risk of missing any step that the IDE takes to do it.
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

wp

  • Hero Member
  • *****
  • Posts: 11854
Re: ide runs older version of my project
« Reply #23 on: September 17, 2019, 05:53:51 pm »
[...] after simply doing project "save as.."  in another folder [...]
This is not the correct way to make a backup copy of a project. When you call "Project" > "Save as" only the project files (.lpi and .lpr) are saved to the new folder, the units remain at their old location. References to the units are changed such that the units are found from the project in new folder. So, when you compile the project in the new folder it will use units from the old folder.

In order to make a backup copy of a project you can use "Project" > "Publish project" which just copies all required files to a new directory but does not change any unit references. Alternatively you can also simply use the file manager of the operating system, outside Lazarus, to copy the project folder.

valdir.marcos

  • Hero Member
  • *****
  • Posts: 1106
Re: ide runs older version of my project
« Reply #24 on: September 18, 2019, 01:17:39 am »
[...] after simply doing project "save as.."  in another folder [...]
This is not the correct way to make a backup copy of a project. When you call "Project" > "Save as" only the project files (.lpi and .lpr) are saved to the new folder, the units remain at their old location. References to the units are changed such that the units are found from the project in new folder. So, when you compile the project in the new folder it will use units from the old folder.

In order to make a backup copy of a project you can use "Project" > "Publish project" which just copies all required files to a new directory but does not change any unit references. Alternatively you can also simply use the file manager of the operating system, outside Lazarus, to copy the project folder.
End of the mystery.
Thank you all.

 

TinyPortal © 2005-2018