Willi Fuchs 0 Posted January 25, 2023 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
Lars Fosdal 1792 Posted January 25, 2023 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
Willi Fuchs 0 Posted January 25, 2023 I checked, and there is no other instance running. And the problem persist when I restart the IDE Share this post Link to post
Lars Fosdal 1792 Posted January 26, 2023 Have you excluded the output folder from AntiVirus software? Also, have a look at https://learn.microsoft.com/en-us/sysinternals/downloads/process-explorer which can reveal what process that is holding the file. Share this post Link to post
Jirka52 2 Posted January 26, 2023 It happens also with Delphi 11.2 Alezandria. It is antivirus Share this post Link to post
Willi Fuchs 0 Posted January 29, 2023 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
SwiftExpat 65 Posted January 30, 2023 Willi, 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
MikeM 0 Posted April 30, 2023 I had the problem myself. I just got Delphi 11.3 yesterday, so I am quite unfamiliar with it, but I found the problem, and it was my own stupidity that caused it. I was the OnShow event for the main form running an ADOQuery and was putting the result (a single field) into a TComboBox. Like a complete rookie, I opened the query and had to keep populating the ComboBox until end of file. The really stupid thing I did not do was to have the query go to the next record, so it was in an infinite loop. When I discovered my mistake I slapped myself in the forehead and fixed the problem. Application compiles now and is visible and everything works well. So, it might be good to check the OnShow or some of the other events to make sure there is not an infinite loop. Share this post Link to post