[Solved] Inconistant QMake results with MSVC and Subdirs Project?
-
I recently made a switch from Qt 4.8 minGW to Qt 5.1 MSVC 64 bit. My project is a subdirs project with 4 projects (common, dialogA, dialogB and mainWindow). When I ran the target project (mainWindow) with Qt 4.8 minGW, I never had a problem and the mainWindow always launched when I hit run. However, once I made the switch to Qt 5.1 MSVC 64, the results have been very intermittent. Sometimes when hit run, it dies silently, other times dialogA launches, and once in a blue moon my mainWindow launches. I've tried several things but nothing has provided me with a consistent result. I've double checked and tripled checked to make sure my run target is correct. I've cleaned, ran qmake and then rebuild for the whole project and also one project at a time, but I always get inconsistent results. Any suggestions?
-
After doing a little more troubleshooting, I was able to isolate my problems to QMAKE. Once I had good makefiles, I was able clean and rebuild many times quite reliably. On a project that would not run, I swapped the bad makefiles with good makefile and I could rebuild and run just fine. I did a comparison (with the diff tool) of the good makefiles and bad makefiles and here is what I found.
- Subdirs project - the same with the exception of the time stamp
- sub projects - very different. obj files listed in very different order and the bad makefiles were larger...one was larger by over 400 lines.
Any Suggestions?
The following section seems to be random when running qmake and seems to be key....when I copy and paste this section from the good makefile to the bad makefile, I can rebuild and run project.
@
From the Makefile.SUFFIXES: .c .cpp .cc .cxx
{..\common\customwidgets}.cc{}.obj::
$(CXX) -c $(CXXFLAGS) $(INCPATH) -Fo @<<
$<
<<
{..\common\customwidgets}.cxx{}.obj::
$(CXX) -c $(CXXFLAGS) $(INCPATH) -Fo @<<
$<
<<
{..\common\customwidgets}.c{}.obj::
$(CXX) -c $(CXXFLAGS) $(INCPATH) -Fo @<<
$<
<<
{..\common\customwidgets}.cpp{}.obj::
$(CXX) -c $(CXXFLAGS) $(INCPATH) -Fo @<<
$<
<<...this pattern continues until it completes all the obj files for my project.....but every time I run qmake this section is in a different order.
@ -
I created a test project from scratch with the same structure and I noticed the makefile did not have the same section which is causing the problem. What controls "Implicit rules"?
-
The problem was "QTBUG-13496":https://bugreports.qt-project.org/browse/QTBUG-13496
The work around is to put the following in the project file (.pro):
@CONFIG += no_batch@