Reputation: 676
So for some time now I keep having this problem:
on windows 7 (64bit), with Delphi 7 and Delphi XE2, if from within the IDE, I compile a program, run it, stop it, change it and rerun it I get this error message:
[Fatal Error] Cannot create output file "project1.exe"
I have no clue to what causes this. I googled for more information, but I could not find a solution.
There are two workarounds: either wait a minute or two, or delete project1.exe manually. Needless to say, this is unworkable.
I do not have a virus scanner, and no virus. Have full access to related folders. Run everything as Administrator.
So what causes this? And what can I do to fix it?
Upvotes: 16
Views: 58084
Reputation: 1
A solution that has worked for me, change project options -> Linking and leave it like that, then delete the executable manually and solved.Project options -> linking
Upvotes: 0
Reputation: 1
1/29/2020: During the past week, I experienced this: Load a project in Delphi 7 on a Win 10 machine, compile it (successfully), run the project from inside of D7 (successful), recompile the project and get a "cannot create ....project1.exe". Upon reboot, can successfully compile and execute, but the second compile fails as the above. I found that Dell Support Assist had an update 8 days ago (about the time this started), so I uninstalled it. After that, no problems with D7.
Upvotes: 0
Reputation: 1
I had the same problem and then I found it on details tab.
Upvotes: 0
Reputation: 1921
Watch this link :
How to fix Error : [dcc32 Fatal Error] F2039 Could not create output file X
Only you most put this command to all projects.
Upvotes: 1
Reputation: 510
In my case Problem solved by excluding project folder from antivirus real time protection.
Can you delete EXE file manually?If no , proccess is in memroy , Open task manager ,select your project, END task . you have some bug in code that prevents application terminate.
If it is not in process list , Then Try :
1-exclude folder from windows Indexing or 3rd party file search applications that index files
2-In windows seven activate application experince service
3-Exclude project folder from Anti virus realtime protection
UPDATE
I noticed that ,Even if you do all what i said above, you may get this error some times in Windows 7 randomly.specially when you compile project many times...first compiles will be OK but after ten or more times this problem will be occurred
Upvotes: 1
Reputation: 886
In my case it was due to the output folder that did not exist.
So what you can try is go to Project-> Options and under the Directories tab, change the output directory to a folder that exists and try again.
Upvotes: 0
Reputation: 1232
I seem to have fixed it by setting the compatibility mode to XP SP3. This also fixed another annoyance which made Alt-P not open bring up the Project menu.
EDIT: I didn't have to re-enable my Application Experience. Still dead where it should be :)
Right-click on your Delphi short-cut, Properties, then choose the Compatibility tab. Choose Run the program in compatibility mode for: Windows XP (Service pack 3).
(I also checked the Run this program as an administrator box, but you may choose not to do that.)
(This is for Delphi 7, as per the OP's question, not for XE7, although it may work for that too.)
Upvotes: -1
Reputation: 21
Sometimes Microsoft Security Essentials holds the file after it was build in Delphi and you need to turn off real time protection.
To check which process holds the file, use Sysinternals Process Explorer: link. Use "Find handle" and type your exe name.
Upvotes: 0
Reputation: 3392
I'm on XE7 and occasionally experience the "Could not create output file" problem, f2039. Using sysinternals' Process Explorer, I discovered an android debug process (adb.exe) had a lien on the compiled binary. Not sure why; there's no android config in this particular win32 project I'm building. Anyway, killed adb.exe and all was good thereafter.
Some points. The target output directories were never being indexed. "Application Experience" mentioned elsewhere in this thread was running the entire time. And most of the time, I could manually delete the output binary despite XE7's complaints. I noticed at one point, however, I could not delete the binary via the shell which provided the opportunity to locate the offending adb.exe via Process Explorer.
Upvotes: 4
Reputation: 31
I faced the same problem and I solved it . It seems that in some unknown cases the exe application remains running .
The solution is simple . You must just follow the following steps :
And everything will be alright.
Upvotes: 3
Reputation: 11
I right clicked the application (in the project group window) and then selected CLEAN.
I was then able to compile the application.
Upvotes: 1
Reputation: 21
Try removing Castalia if you are using it. I spent 3 days trying to solve this problem, everything I could think of...file permissions, watching the file handles with process explorer. If I install Castalia 2013.3.4, the problem happens (I have steps to reproduce), and uninstalling it makes the problem go away.
Additionally, the IDE will crash if you have a 'default debug desktop' set, and try to run under the debugger using any other saved layout. (crash happens on the switch to the debug desktop).
Upvotes: 1
Reputation: 676
I found the solution. It appears that disabling the service "Application Experience" caused this. When disabled the task "system" will lock "any" executable for some time.
Re-enabling "Application Experience" is the solution.
Found via:
Upvotes: 16
Reputation: 7562
I have the feeling that when you try to rebuild the application, project1.exe is still running. Maybe it takes longer than it should to close. You can easily check by opening Task Manager and see if the process project1.exe is still active after you close the application.
Upvotes: 5