Jump to content
Willi Fuchs

Fatal Error F2039 - Could not create output file

Recommended Posts

I am using the IDE of Delphi 10.1 under Windows 10.

After several tests with a program under development which seemed to work quite well, I suddenly got an error message F2039 which says: Could not create output file.

There are no other error messages from the compiler, except some irrelevant hints (such as:  variable....never used).

The problem is, the program was started and running correctly a short time before, and since then I did not change anything in the code.

I have no idea where to look for a solution.


Share this post

Link to post

Have you checked if an instance of the output app is still running?
Does the problem persist if you restart the IDE?


Share this post

Link to post

It happens also with Delphi 11.2 Alezandria. It is  antivirus

Share this post

Link to post

I cannot find where any antivirus program should be the problem.

But I have found the following situation:

My program seems to have a problem, perhaps with a file which is opened but not closed or a loop running continuosly?

The first time I start the IDE and run my program (in debug mode), it starts normally, but terminates with an error (access violation at address ...).

But I can only find the reason for the error if I can use the IDE and work on the code.

If I try to start it again, the ominous error F2039 appears immediately. Ending the Delphi IDE and restarting it, does not help.

Restarting the whole PC does help indeed, and at least once I can restart the program.


It seems to me that the problem with error F2039 is: the IDE cannot create a new executable file (Project1.exe) because the old one is still running (indefinitely?).

If I try to delete the executable (Project1.exe) in ...\Win32\Debug\ I get an error message saying the (delete) action cannot be completed because the file is open in Project.exe.

But the Task Manager in the "show fewer details" mode does NOT show this program running!

In the "Show more details" mode I can find <Project.exe> and end this task.


My conclusion is: My program still has a problem with something running indefinitely. I have to and will find the reason quite soon.

But this is tricky, because I can only make test runs as long as the executable file from the last test run is deleted manually.

And it was not easy to find out what happens really.


Thanks for the cooperation and ideas.



Share this post

Link to post


The behavior is expected if your code is hung, the IDE does not actually clean up the process. I wrote an IDE expert, but it is only for Delphi 10.3, 10.4 & 11.


You can create a tool in the IDE to make killing the process simpler, see this thread, page 4 look for taskkill and then set the correct exe name to cleanup your project.


Share this post

Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now