In Qt Creator, I have a pro file using PRECOMPILED HEADERS.
The build works just perfect when I build in Release mode. But building in Debug mode gives errors, generating object files failing. Example:
17:12:40: Running steps for project Euclide...
17:12:40: Configuration unchanged, skipping qmake step.
17:12:40: Starting: "C:\Qt\Tools\mingw48_32\bin\mingw32-make.exe"
C:\Qt\5.2.0\mingw48_32\bin\qmake.exe -spec win32-g++ CONFIG+=debug -o Makefile ..\euclide\Euclide.pro
C:/Qt/Tools/mingw48_32/bin/mingw32-make -f Makefile.Debug
mingw32-make[1]: Entering directory 'C:/UserPrograms/Euclide/build'
g++ -c -include debug\_pch.h -pipe -fno-keep-inline-dllexport -std=gnu++11 -g -frtti -Wall -Wextra -fexceptions -mthreads -DUNICODE -DQT_WEBKITWIDGETS_LIB -DQT_MULTIMEDIAWIDGETS_LIB -DQT_QUICK_LIB -DQT_POSITIONING_LIB -DQT_OPENGL_LIB -DQT_PRINTSUPPORT_LIB -DQT_WEBKIT_LIB -DQT_MULTIMEDIA_LIB -DQT_QML_LIB -DQT_WIDGETS_LIB -DQT_NETWORK_LIB -DQT_SENSORS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -I..\euclide -I"..\..\..\Program Files (x86)\boost\boost_1_53_0" -I"..\numlib\mathvec" -I"..\..\..\Qt\5.2.0\mingw48_32\include" -I"..\..\..\Qt\5.2.0\mingw48_32\include\QtWebKitWidgets" -I"..\..\..\Qt\5.2.0\mingw48_32\include\QtMultimediaWidgets" -I"..\..\..\Qt\5.2.0\mingw48_32\include\QtQuick" -I"..\..\..\Qt\5.2.0\mingw48_32\include\QtPositioning" -I"..\..\..\Qt\5.2.0\mingw48_32\include\QtOpenGL" -I"..\..\..\Qt\5.2.0\mingw48_32\include\QtPrintSupport" -I"..\..\..\Qt\5.2.0\mingw48_32\include\QtWebKit" -I"..\..\..\Qt\5.2.0\mingw48_32\include\QtMultimedia" -I"..\..\..\Qt\5.2.0\mingw48_32\include\QtQml" -I"..\..\..\Qt\5.2.0\mingw48_32\include\QtWidgets" -I"..\..\..\Qt\5.2.0\mingw48_32\include\QtNetwork" -I"..\..\..\Qt\5.2.0\mingw48_32\include\QtSensors" -I"..\..\..\Qt\5.2.0\mingw48_32\include\QtGui" -I"..\..\..\Qt\5.2.0\mingw48_32\include\QtCore" -I"debug" -I"." -I"." -I"..\..\..\Qt\5.2.0\mingw48_32\mkspecs\win32-g++" -o debug\main.o ..\euclide\main.cpp
Makefile.Debug:1543: recipe for target 'debug/main.o' failed
mingw32-make[1]: *** [debug/main.o] Error 1
mingw32-make[1]: Leaving directory 'C:/UserPrograms/Euclide/build'
makefile:34: recipe for target 'debug' failed
mingw32-make: *** [debug] Error 2
17:12:59: The process "C:\Qt\Tools\mingw48_32\bin\mingw32-make.exe" exited with code 2.
Error while building/deploying project Euclide (kit: Desktop Qt 5.2.0 MinGW 32bit)
When executing step 'Make'
17:12:59: Elapsed time: 00:19.
What is really confusing is that it works fine in Release. I made some tests with a small project and it works fine in Release or Debug modes, but for any reason, a bigger project is failing. It is even impossible to compile a single file of the project in Debug. The pro file is below:
QT += core gui \
webkitwidgets \
printsupport
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = Euclide
TEMPLATE = app
QMAKE_CXXFLAGS += -std=gnu++11
CONFIG += precompile_header
# Use Precompiled headers (PCH)
PRECOMPILED_HEADER = _pch.h
SOURCES += main.cpp\
mainwindow.cpp \
zero.cpp \
... lot of files here...
debug_tool.cpp
HEADERS += mainwindow.h \
zero.h \
... lot of files here...
debug_tool.h \
_pch.h
FORMS += mainwindow.ui \
zero.ui \
... other files...
apphelp.ui \
message.ui
INCLUDEPATH = "C:/Program Files (x86)/boost/boost_1_53_0"
LIBS += \
../build/release/exprcompiler.dll
RESOURCES += \
resources/euclide_resources.qrc
I spent days of extensive resarch on the net to fix this problem but not found any explanation, even if documentation about qmake is complete...
Does anyone know how to fix this problem ? because the only solution I consider now, is to have a special "Debug" version of this all project, without precompiled headers... Thanks for your help.