Recent

Author Topic: unable to create EXE file, even from a new project with a previuosly working uni  (Read 4465 times)

steveinalabama

  • New Member
  • *
  • Posts: 21
I am having serious problems in Lazarus.
I went to run a program I wrote a few days go. I could not find the EXE file.
I went into Lazarus to recompile it, and loading recent projects did not include it.

I found the unit on my own and loaded it into Lazarus. When I ran it with F9 it did
not show the form or do anything...it said "debugging", butI had no breakpoints set.
I put showmessages in the form onactivate and formcreate events but they never run.

I created a brand new project, then I added my previously working unit to the project,
and selected it under forms. When I press F9 I get an error that it cannot create the exe file.
There already was a project1.exe file, which I tried to delete under windows explorer but it
would not delete, saying file is in use by project1.exe. This after I said close all in
Lazarus and exited from Lazarus.

I wnet into task manager to end it, but it was not there under apps. but did find it under "details"
where it showed it there twice, and the rightmost column says "disabled". I selected "end task" for both.
I select run without debugging, and nothing happened. I pressed f9 again in Lazarus and the original problem of noothing happens, no showmessages come up, and
Lazarus says "debugging".

I have renamed the unit pas and lfm files, thinkking it was getting confused with
the names unit1.pas and lfm but no help... back to cannot create (newly named project).exe file.

I uninstalled Lazarus, and reinstalled it 7 days ago on a similar problem and never solved that,
which is what prompted me to create a brand new project

I have spent 7 days on this and it has become completely unusable to me. It is as though you
cannot reuse a unit file in a new project even after adding file in editor to project.

What am I missing?



dseligo

  • Sr. Member
  • ****
  • Posts: 343
Does this problem only shows with this particular unit?
It is possible that there is some code in the unit that cause your program to 'hang'.

When this happen, try to use menu Run in Lazarus, and then 'Stop' (or you can press Ctrl+F2 in Lazarus). Does Lazarus stop showing 'debugging'?

What is your Lazarus version and what OS do you use (I guess Windows, but what version)?
Is it 32 or 64 bit program?

You can reuse units in new projects, I assure you.

steveinalabama

  • New Member
  • *
  • Posts: 21
The OS is Windows 10, running Lazarus version 2.0.1.2
I open a specific unit, press F9, and a completely different unit is running. It says "debugging" and if I choose stop from the run menu, the program ends  but the file I just loaded is closed.

How is it that opening unit_a and trying to run actually runs unit_b?

steveinalabama

  • New Member
  • *
  • Posts: 21
Another clue: I exit Lazarus, start it again, load in the same unit, and purposely enter syntax errors by misspelling a variable name, and it gets no syntax error. It does not even try to compile the opened unit.


marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 9521
  • FPC developer.
Problems with debugging: make sure all lazarus directories are excluded from the antivirus and test again.

Antivirusses sometimes frowns on exes generating exes (compilers)and exes loading exes(debuggers)

dseligo

  • Sr. Member
  • ****
  • Posts: 343
Another clue: I exit Lazarus, start it again, load in the same unit, and purposely enter syntax errors by misspelling a variable name, and it gets no syntax error. It does not even try to compile the opened unit.

This looks like it is something wrong with your project setup. Try to go Project --> Project inspector and see if there are correct files there.
I would rename all units to something new, then check if new ones are in Project inspector, then check project source uses clause (Project --> View Project Source) to see if there are also only new units, and then check each units uses clause.

Also check Project --> Project Options, Path if there is maybe defined some path to your other projects units directory.

steveinalabama

  • New Member
  • *
  • Posts: 21
Problem solved after creating another new project.

Regarding the compile of another unit, even though I had already added the correct unit to the project, I put a break point in the form activate event, and it would not compile, indicating it expected a "BEGIN", implying the begin and end stmts were not all aligned. I went through every line of code and all the begins did have an end,so I commented out sections of the code, and the commenting out did not work correctly, when using the (* and *) characters. I did see a line of code with "select count(*)..." and figured the count(*) was confusing the ide editor, but even using the // to comment out the  count(*)
line did not help. Luckily I did not save the pas file with my commented out attempts.

I created another new project, and without changing anything in my code, it ran fine.





 

TinyPortal © 2005-2018