I'm developing in Qt 5.11.1/ Qt Creator 4.6.2, with the default compiler kit that came with QtInstaller, MinGW 5.3.0 32bit. My system is Windows 10 64bit.
After several runs without any error (months), I'm starting to get the following error sometimes:
Cannot open output file debug\prog.exe: Permission denied
error: ld returned 1 exit status
File not found: collect2.exe
I've already open the Task Manager to see if my program's still running but there isn't any entry there. And it appears to be a problem with the executable in the folder "debug", because after that, I'm not allowed to erase the prog.exe. The message box said I don't have the right permissions, but I'm the administrator user.
The problem only disappear if I restart Windows.
Here's my .pro code:
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 +=
And here's my Compile Output:
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.
Can someone help me? Any idea about how to solve?
Related
My application builds and runs fine in Release mode. However, in Debug mode, my application crashes. When trying to use debugger to pinpoint the crash cause, such error is received:
Qt Creator unexpected CDB exit
The CDB process terminated
What could possibly be the problem cause?
UPDATE
I built and deployed the application in Debug mode and then tried to run the executable by command like:
C:\Users\m3\Documents\deployment_folder>.\application.exe
and I received this message:
The code execution cannot be proceed because tbb_debug.dll was not found. Reinstalling the program may fix this problem.
For some reason, tbb.dll can be found in Release mode but tbb_debug.dll cannot be found in debug mode. Although all TBB DLLs are in the same directory. Not sure why ...
UPDATE
I'm adding TBB to my project with QMake like this:
INCLUDEPATH += deps/tbb-2020.3-win/tbb/include
# Looks like absolute path works for LIBS, but NOT relative path
win32: CONFIG (release, debug|release): {
LIBS += -LC:\Users\m3\repos\myapp\deps\tbb-2020.3-win\tbb\lib\intel64\vc14 \
-ltbb \
-ltbb_preview \
-ltbbbind \
-ltbbmalloc \
-ltbbmalloc_proxy \
-ltbbproxy
} else: win32: CONFIG (debug, debug|release): {
LIBS += -LC:\Users\m3\repos\myapp\deps\tbb-2020.3-win\tbb\lib\intel64\vc14 \
-ltbb_debug \
-ltbb_preview_debug \
-ltbbbind_debug \
-ltbbmalloc_debug \
-ltbbmalloc_proxy_debug \
-ltbbproxy_debug
} else: unix: { # Linux and mac
# TODO: add correct path to LIBS +=
}
The problem is resolved by manually copying TBB DLLs next to the application executable.
Copy from ... /tbb-2020.3-win/tbb/bin/intel64/vc14/*.dll to executable location.
On why release mode worked
I think some 3rd party application has already added tbb.dll to may PATH environment variable. But tbb_debug.dll is not added to PATH by any application. Just a guess ...
I have problems since I installed both Qt 4.8.4 and Qt 5.1 on my computer.
When only Qt 4.8.4 was present, everything was fine.
When I added Qt 5.1, this one is working properly, but Qt 4.8.4 gives me these linker errors:
Makefile:34: recipe for target 'debug' failed
c:/mingw/bin/../lib/gcc/mingw32/4.7.2/../../../../mingw32/bin/ld.exe: cannot find -lQtGuid
c:/mingw/bin/../lib/gcc/mingw32/4.7.2/../../../../mingw32/bin/ld.exe: cannot find -lQtCored
collect2.exe: error: ld returned 1 exit status
mingw32-make[1]: *** [debug/BuildSystemTest3.exe] Error 1
mingw32-make: *** [debug] Error 2
09:21:00: The process "C:\MinGW\bin\mingw32-make.exe" exited with code 2.
Error while building/deploying project BuildSystemTest3 (kit: Desktop)
When executing step 'Make'
I could replicate the problem on a trivial test project (the one created by QtCreator by default), with this pro file:
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = BuildSystemTest3
TEMPLATE = app
SOURCES += main.cpp mainwindow.cpp
HEADERS += mainwindow.h
The two Qt versions are installed in two separate directories: C:\Qt\4.8.4 and C:\Qt\Qt5.1.0
MinGW is a link to either MinGW_4.6.2 (for Qt4) or MinGW_4.7.2 (for Qt5).
Can different versions of Qt coexist on the same computer? How?
I think there might be a problem with the QTDIR environment variable pointing to the 5.1 installation.
You could create two batch files like this (might have to add full path to qtcreator.exe):
qtcreator484.bat:
set QTDIR=C:\Qt\4.8.4
start qtcreator.exe
qtcreator510.bat:
set QTDIR=C:\Qt\5.1.0
start qtcreator.exe
and place them e.g. on your desktop. Then always start QtCreator via the batch files for the configuration you want.
Side node: There are sometimes problems when having two QtCreator instances up at the same time, e.g. the second instance cannot write to the console.
I’m working on a project with opencv lib. I use Qt 4.8 on Windows 7 and it gives me an error when building the project:
mingw32-make.exe[1]: *** Access is denied.
. Stop.
mingw32-make.exe: *** [release] Error 2
19:05:06: The process "F:\QtSDK\mingw\bin\mingw32-make.exe" exited with code 2.
Error while building project TraySystemtry (target: Desktop)
When executing build step 'Make'
The pro file:
QT += xml svg core gui
CONFIG += qt
VERSION = 0.3.0
TEMPLATE = app
INCLUDEPATH += D:\OpenCV\opencv\build\include
LIBS += -LD:\OpenCV\opencv_Build\bin\
-lopencv_core242 \
-lopencv_highgui242 \
-lopencv_imgproc242 \
-lopencv_features2d242 \
-lopencv_calib3d242 \
-lopencv_objdetect242
HEADERS += \
window.h \
aboutus.h \
abouttab.h \
developertab.h \
privacytab.h \
classificationhand.h \
keyssetup.h
SOURCES += \
window.cpp \
main.cpp \
aboutus.cpp \
abouttab.cpp \
developertab.cpp \
privacytab.cpp \
classificationhand.cpp \
keyssetup.cpp
RESOURCES += \
systray.qrc
I can’t figure out the problem.
I have the same problem. For mine, I resolved it just disabling the antivirus (Kaspersky). The antivirus was denying mingw32-make.
There are at least two possible causes:
The file you're trying to build is open/used (the program is running)
You don't have sufficient privileges (you don't have admin rights)
Cause #1 is often more likely than cause #2.
For me it usually means that the exe that I'm trying to compile is currently open (i.e., running). This often happens when I have it running in debug mode, then try to recompile.
Running build steps for project googlechat...
Starting: c:/qt/4.7.0/bin/qmake.exe C:/NokiaQtSDK/Examples/4.6/webkit/googlechat/googlechat.pro -r -spec symbian-abld
WARNING: c:\NokiaQtSDK\Examples\4.6\webkit\googlechat\googlechat.pro:15: Unable to find file for inclusion \examples\symbianpkgrules.pri
Exited with code 0.
Starting: C:/Nokia/devices/Nokia_Symbian3_SDK_v0.9/epoc32/tools/make.exe -w
C:\Nokia\devices\Nokia_Symbian3_SDK_v0.9\epoc32\tools\make.exe: Entering directory `C:/NokiaQtSDK/Examples/4.6/webkit/googlechat'
bldmake bldfiles
BLDMAKE ERROR: Can't find any RVCT installation.
C:\Nokia\devices\Nokia_Symbian3_SDK_v0.9\epoc32\tools\make.exe: *** [ABLD.BAT] Error 1
C:\Nokia\devices\Nokia_Symbian3_SDK_v0.9\epoc32\tools\make.exe: Leaving directory `C:/NokiaQtSDK/Examples/4.6/webkit/googlechat'
Exited with code 2.
Error while building project googlechat (target: Symbian Emulator)
When executing build step 'Make'
Remove ARM5 and ARM6 target from your bld.inf file. You have to do this before each build,
this is a bug with qmake and Symbian^3 SDK.
If you use Mobility APIs you also need to copy the epoc/include/mw to epoc/include/middleware for compiling successfully.
I have coded a program in QTcreator on linux and when i tried to port it to windows.
Program compiles without any errors.
But when i run the program it exits automatically
Starting C:\Projects\LIG\debug\LIGenerator.exe...
C:\Projects\LIG\debug\LIGenerator.exe exited with code -1073741515
I tried to debug it using QT creator debugger. But flow of the program does not pass even through main.cpp
how to debug the program and fine where is the errors.
Update
In the .pro file the INCLUDEPATH and LIB are the following
win32:INCLUDEPATH += "C:\Program Files\Expat 2.0.1\Source\lib"
win32:INCLUDEPATH += "E:\confuse-2.7\confuse-2.7\src"
win32:INCLUDEPATH += "C:\Projects\LithologyInputGenerator5\XML"
win32:LIBS += -L"C:/Program Files/Expat 2.0.1/Bin" \
-L"C:/Program Files/GnuWin32/lib/" \
-L"E:/confuse-2.7/confuse-2.7/windows/msvs.net/libConfuse/Release"
LIBS += -lexpat \
-lcrypto \
-lssl\
-lconfuse
unix:LIBS += libgsoap++.a \
-lgsoap
win32:LIBS += -lwsock32
Update
I have used dependency walker as mentioned which help me to find the missing dependencies. I have now fixed all the dependencies except MPR.DLL ( Warning: At least one module has an unresolved import due to a missing export function in a delay-load dependent module.). IT was not missing so i left it out.
Also i have used a configuration file. I have now copied the conf file to debug dir for WIN32 compiler.I don't remember whether i have used more than one conf file
Still the program automatically exit with code -1073741515
. I tried to debug program using GUI debugger . But program is not even breaking at main also.
Could any one help me to get out of the this?
-1073741515 is the same as 0xC0000135 which I think often is because a a dependency is missing. I'd suggest checking that all DLLs your app depends on are in the correct locations.
You can use Dependency Walker for this.
I had the same problem, fixed by changing project settings Projects -> Tool chain -> MinGW (x86 32bit)