On Windows 7 I was using Qt 5.12.6 with Qt Creator 4.10.2 IDE and compiling with MinGW 64-bit utilizing the provided qmake, on Windows 7. I ran into an interesting situation.

When attempting to compile and debug a project, Qt Creator started giving the following message

:-1: error: cannot open output file debug\TestFlight.exe: Permission denied
collect2.exe:-1: error: error: ld returned 1 exit status


Assuming that the program somehow was not shut down correctly, I could not find any reference to the program using the task manager, so I attempted to see if it would run stand-alone, which just resulted in the following...

Windows cannot access the specified device, path, or file. You may not have the appropriate permissions to access the item.

This appeared odd seeing as I have full administrative permissions and I should be the owner of the file. So I attempted to access the permissions of the file to see what exactly was going on by highlighting the file and taking the following steps...

1 Right clicked the file
2 Selected properties
3 Selected the security tab which then caused a new window to pop up with the following statement...

To continue, you must be an administrative user with permission to view this object's security properties

4 Clicked Continue

A window then popped up displaying a message stating that I do not have permission to view the object’s security properties along with a section that should have displayed the owner information and another section with a list of users. However in the current owner section, it simply stated...

Unable to display current owner. To try taking ownership of the object select an account from the list, and then click OK.

5 There were two accounts in the list. Both of them were mine and they both had admin privileges. I attempted to change the owner using both accounts and each time a window popped up and sated...

Unable to set new owner on file name.
Access is denied


without any further explanation.

I’m somewhat confused on this one since I have full admin privileges and it doesn’t let me change, access, or even delete the file. I have run the Build->Clean All and Build->Run qmake options from the menu with out any effect on the outcome. So I rebuilt the whole program and attempted it again.

The rebuilt program compiled and ran just fine and did not exhibit any of the signs or problems experienced on prior attempts. When I checked the executable in the debug directory I was able to access the parameters and security settings of the file and I was listed as the owner. So after some minor coding changes, I checked the executable file in the debug directory again, and everything was as it should be. I felt it was fine to go ahead and attempt to compile it again.

Unfortunately, during the compile the same issues were reported by Qt Creator as with the prior build...

:-1: error: cannot open output file debug\TestFlight.exe: Permission denied
collect2.exe:-1: error: error: ld returned 1 exit status


In addition to searching in the Task Manager and Process Explorer I’ve rebuilt this program several times, changed directories, scoured the operating system environment for anomalies, and shut down any other programs that were running. and yet I’m still getting the same results. I searched for and found a multitude of similar situations on several programming boards (including this one) but there have been no satisfactory solutions with the exception that some individuals seem to have found that turning on “Application Experience” in Windows seems to resolve the issue. Unfortunately, this appears to be a feature that is not in Windows 7. I’ve run out of things that I know to check for. I strongly suspect that this may be a problem minGW or maybe Windows, but if anyone has any insight on this issue, it would be highly appreciated.