Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Permission denied and Collect2.exe error



  • Hi All,

    I'm trying to compile and run a programm and I constantly receive these two error messages.
    error: cannot open output file debug\ProjektMockUp.exe: Permission denied
    error: collect2.exe: error: ld returned 1 exit status

    I really don't know what to do. It started once, crashed, I closed it. I cannot see anything running in the Task Manager, I deactivated my Anti Virus.
    Any Idea?
    Thanks a lot in advance!

    This is what the Compile Output tab provides:

    C:/Qt/Qt5.12.8/Tools/mingw730_64/bin/../lib/gcc/x86_64-w64-mingw32/7.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot open output file debug\ProjektMockUp.exe: Permission denied
    collect2.exe: error: ld returned 1 exit status
    mingw32-make[1]: *** [Makefile.Debug:69: debug/ProjektMockUp.exe] Error 1
    mingw32-make[1]: Leaving directory 'C:/Users/Lukas/Desktop/QT/Arrays/build-ProjektMockUp-Desktop_Qt_5_12_8_MinGW_64_bit-Debug'
    mingw32-make: *** [Makefile:38: debug] Error 2
    15:42:08: The process "C:\Qt\Qt5.12.8\Tools\mingw730_64\bin\mingw32-make.exe" exited with code 2.
    Error while building/deploying project ProjektMockUp (kit: Desktop Qt 5.12.8 MinGW 64-bit)
    When executing step "Make"


  • Lifetime Qt Champion

    @Freiluk Delete the executable file and build again



  • Hi,
    thanks for the quick reply :)
    doesn't work unfortunately.
    Windows says it is still running/opened somewhere.. I scrolled through the Task Manager 4 times now and cannot find it :(


  • Lifetime Qt Champion

    @Freiluk What works most of the time with Windows is a reboot :-)


  • Moderators

    Process Explorer (https://docs.microsoft.com/en-us/sysinternals/downloads/process-explorer ) allows you to search all processes by handle or DLL substring. But yes, restarting Windows usually helps, too ;)



  • This is amazing thank you!
    I finally found it!

    Reboot didn't work, and I finally figured, that I should not run it in Debug mode rather in Release.

    Thanks a lot for your quick help!

    Edit: Process Lasso eventually solved it best for me. It consitently showed the falsely running processes and .exe.


Log in to reply