[Qt-creator] Compiling fails to link *sometimes*

Murphy, Sean smurphy at walbro.com
Wed Jul 9 18:01:06 CEST 2014


I've got an odd issue that happens sometimes with Qt Creator 3.1.1 on Windows (Windows 7 64-bit if it matters...).  When I go to compile my project, sometimes it will error out saying something like "failing to create myApp.exe, permission denied".  Sorry for not including the exact error, naturally I can't get it to do it now.

Even though I get that error, it appears I have a newly built application that has the correct timestamp on it.

Looking at the "Compile Output" tab, I see the following linker line repeated four times:
g++ -Wl,-subsystem,windows -mthreads -o "debug\myApp.exe" "object_script.myApp.Debug" -lglu32 -lopengl32 -lgdi32 -luser32 -lmingw32 -lqtmaind -LC:/Qwt-6.1.0/lib -lqwtd -LC:\Qt\5.2.0\mingw48_32\lib -lQt5Svgd -lQt5Widgetsd -lQt5SerialPortd -lQt5Guid -lQt5Cored
g++ -Wl,-subsystem,windows -mthreads -o "debug\myApp.exe" "object_script.myApp.Debug" -lglu32 -lopengl32 -lgdi32 -luser32 -lmingw32 -lqtmaind -LC:/Qwt-6.1.0/lib -lqwtd -LC:\Qt\5.2.0\mingw48_32\lib -lQt5Svgd -lQt5Widgetsd -lQt5SerialPortd -lQt5Guid -lQt5Cored
g++ -Wl,-subsystem,windows -mthreads -o "debug\myApp.exe" "object_script.myApp.Debug" -lglu32 -lopengl32 -lgdi32 -luser32 -lmingw32 -lqtmaind -LC:/Qwt-6.1.0/lib -lqwtd -LC:\Qt\5.2.0\mingw48_32\lib -lQt5Svgd -lQt5Widgetsd -lQt5SerialPortd -lQt5Guid -lQt5Cored
g++ -Wl,-subsystem,windows -mthreads -o "debug\myApp.exe" "object_script.myApp.Debug" -lglu32 -lopengl32 -lgdi32 -luser32 -lmingw32 -lqtmaind -LC:/Qwt-6.1.0/lib -lqwtd -LC:\Qt\5.2.0\mingw48_32\lib -lQt5Svgd -lQt5Widgetsd -lQt5SerialPortd -lQt5Guid -lQt5Cored

So what I think is happening is that the link step is being executed multiple times for some reason, and on one of them Windows thinks the file is still open for writing, and the subsequent attempt to open the file fails.  If I load in a different Qt project (like a Qt example) that line is only included once.  Here's my .pro file, edited a little for brevity (I just snipped out the .h/.cpp/.ui file names):
#-------------------------------------------------
#
# Project created by QtCreator 2013-12-12T17:25:12
#
#-------------------------------------------------

QT       += core gui serialport

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

TARGET = "myApp"
TEMPLATE = app
CONFIG += qwt

OBJECTS_DIR = .obj
MOC_DIR = .moc
UI_DIR = .ui

INCLUDEPATH += ../shared

SOURCES += <all my .cpp files>

HEADERS  += <all my .h files

FORMS    += <all my .ui files>

RESOURCES += \
    myApp.qrc

Thanks in advance,
Sean




More information about the Qt-creator mailing list