首页 > 解决方案 > Qt 错误:“无法打开输出文件 debug\prog.exe:权限被拒绝”

问题描述

我正在使用 QtInstaller 附带的默认编译器工具包 MinGW 5.3.0 32 位在 Qt 5.11.1/Qt Creator 4.6.2 中进行开发。我的系统是 Windows 10 64 位。

经过几次没有任何错误的运行(几个月)后,有时我开始收到以下错误:

Cannot open output file debug\prog.exe: Permission denied
error: ld returned 1 exit status
File not found: collect2.exe

我已经打开任务管理器查看我的程序是否仍在运行,但那里没有任何条目。它似乎是“调试”文件夹中的可执行文件有问题,因为在那之后,我不允许删除 prog.exe。消息框说我没有正确的权限,但我是管理员用户。

仅当我重新启动 Windows 时问题才会消失。

这是我的 .pro 代码:

QT += core gui

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

TARGET = prog
TEMPLATE = app

DEFINES += QT_DEPRECATED_WARNINGS


SOURCES += \
    main.cpp \
    prog.cpp \
    screen1.cpp \
    screen2.cpp \

HEADERS += \
    defineBotoes.h \
    prog.h \
    screen1.h \
    screen2.h \

RESOURCES += \
    resources/prog.qrc

DISTFILES +=

这是我的编译输出:

C:/Qt/Qt5.11.1/Tools/mingw530_32/bin/../lib/gcc/i686-w64-mingw32/5.3.0/../../../../i686-w64-mingw32/bin/ld.exe: cannot open output file debug\prog.exe: Permission denied
collect2.exe: error: ld returned 1 exit status
Makefile.Debug:100: recipe for target 'debug\prog.exe' failed
mingw32-make[1]: Leaving directory 'C:/Users/RENAN-BCC/Desktop/STD/src/prog'
Makefile:36: recipe for target 'debug' failed
mingw32-make[1]: *** [debug\prog.exe] Error 1
mingw32-make: *** [debug] Error 2
08:31:49: The process "C:\Qt\Qt5.11.1\Tools\mingw530_32\bin\mingw32-make.exe" exited with code 2.
Error while building/deploying project prog (kit: Desktop Qt 5.11.1 MinGW 32bit)
When executing step "Make"
08:31:49: Elapsed time: 00:04.

有人能帮我吗?关于如何解决的任何想法?

标签: qt

解决方案


推荐阅读