Results 1 to 3 of 3

Thread: Missing qt/mocinclude.tmp file [Qt 5.5.1, Visual Studio 2010]

  1. #1
    Join Date
    Jun 2008
    Location
    Boulder, Colorado, USA
    Posts
    70
    Thanks
    16
    Thanked 1 Time in 1 Post
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Missing qt/mocinclude.tmp file [Qt 5.5.1, Visual Studio 2010]

    In the course of our Qt4 to Qt 5.5.1 port, we're having a problem replicating a successful application build from one development machine to another.

    On the 2nd machine, no qt/mocinclude.tmp file is being created (in the same directories where all the generated moc_.cpp and ui_.h files go).

    WHY MIGHT THAT BE?


    This is resulting in the following problem with the MOC compilation of Q_OBJECT class header files:

    • moc: Cannot open options file specified with @
    • list itemQCommandLineParser: argument list cannot be empty, it should contain at least the executable name


    The .vcxproj files contain lines such as the following with a "@./qt/mocinclude.tmp" term:

    <Command Condition="&apos;$(Configuration)|$(Platform)&apos ;==&apos;Debug|x64&apos;">
    setlocal&#x000D;&#x000A;if errorlevel 1 goto VCEnd&#x000D;&#x000A;C:\Riverware\tools\
    Qt-551\qtbase\bin\moc.exe -DWIN32 -DWIN64 -DIL_STD -D_WIN32 -DCW_PRESTOPLOT -DCWDEBUG
    -DUSE_NON_CONST -DQT_WEBKITWIDGETS_LIB -DQT_WEBKIT_LIB -DQT_PRINTSUPPORT_LIB
    -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_XML_LIB -DQT_CONCURRENT_LIB
    -DQT_CORE_LIB -D_MSC_VER=1600 -D_WIN32 -D_WIN64 @./qt/mocinclude.tmp
    AccountMgrDlg.hpp -o qt\moc_AccountMgrDlg.cpp&#x000D;&#x000A;if errorlevel 1 goto
    VCEnd&#x000D;&#x000A;endlocal</Command>
    We're using Visual Studio 2010. The first machine (on which Qt 5.5.1 was actually built) is Windows 7. The second machine is Windows 8.1.

    We DO have a lot of "includes". This is from a relevant .pro file:

    INCLUDEPATH += \
    ../Accounting \
    ../AccountingGUI \
    ../ClientServer \
    ../DbDmi \
    ../EngrObjs \
    ../GUI \
    ../Halibut \
    ../Opt \
    ../Optimize \
    ../OracleConnect \
    ../Q3GUI \
    ../QtAccounting \
    ../QtDmi \
    ../QtRpl \
    ../QtRun \
    ../QtSCT \
    ../QtUtils \
    ../Rcl \
    ../Remote \
    ../Rpl \
    ../RplExpression \
    ../RwDoc \
    ../RwOracle \
    ../RwQt \
    ../Servers \
    ../Sim \
    ../Units \
    ../Utils \
    ../VCXX \
    C:/RiverWare/tools/RdfToExcel_Qt-551/include \
    C:/RiverWare/tools/Qwt-612_Qt-551/src \
    C:/RiverWare/tools/RepriseLM-12.0 \
    C:/RiverWare/tools/CPLEX-125/cplex/include \
    C:/RiverWare/tools/CPLEX-125/concert/include \
    C:/RiverWare/tools/Stubs/include \
    C:/RiverWare/tools/tcl-8.6.4/generic \
    C:/RiverWare/tools/gdal-1.9.2/include \
    C:/RiverWare/tools/netCDF-4.3.2/include \
    C:/Riverware/tools/Quazip-0.7.1_Qt-551 \
    C:/RiverWare/tools/protobuf-2.6.0/include \
    C:/RiverWare/tools/icu-55.1/include \
    $$[QT_INSTALL_PREFIX]/src/3rdparty/zlib
    On the original machine, the generated qt/mocinclude.tmp files have this content:

    -IC:/Riverware/tools/Qt-551/qtbase/mkspecs/win32-msvc2010
    -IC:/Riverware/staff/philw/WinQt5Port3/QtAccounting
    -IC:/Riverware/staff/philw/WinQt5Port3/Accounting
    -IC:/Riverware/staff/philw/WinQt5Port3/AccountingGUI
    -IC:/Riverware/staff/philw/WinQt5Port3/ClientServer
    -IC:/Riverware/staff/philw/WinQt5Port3/DbDmi
    -IC:/Riverware/staff/philw/WinQt5Port3/EngrObjs
    -IC:/Riverware/staff/philw/WinQt5Port3/GUI
    -IC:/Riverware/staff/philw/WinQt5Port3/Halibut
    -IC:/Riverware/staff/philw/WinQt5Port3/Opt
    -IC:/Riverware/staff/philw/WinQt5Port3/Optimize
    -IC:/Riverware/staff/philw/WinQt5Port3/OracleConnect
    -IC:/Riverware/staff/philw/WinQt5Port3/Q3GUI
    -IC:/Riverware/staff/philw/WinQt5Port3/QtAccounting
    -IC:/Riverware/staff/philw/WinQt5Port3/QtDmi
    -IC:/Riverware/staff/philw/WinQt5Port3/QtRpl
    -IC:/Riverware/staff/philw/WinQt5Port3/QtRun
    -IC:/Riverware/staff/philw/WinQt5Port3/QtSCT
    -IC:/Riverware/staff/philw/WinQt5Port3/QtUtils
    -IC:/Riverware/staff/philw/WinQt5Port3/Rcl
    -IC:/Riverware/staff/philw/WinQt5Port3/Remote
    -IC:/Riverware/staff/philw/WinQt5Port3/Rpl
    -IC:/Riverware/staff/philw/WinQt5Port3/RplExpression
    -IC:/Riverware/staff/philw/WinQt5Port3/RwDoc
    -IC:/Riverware/staff/philw/WinQt5Port3/RwOracle
    -IC:/Riverware/staff/philw/WinQt5Port3/RwQt
    -IC:/Riverware/staff/philw/WinQt5Port3/Servers
    -IC:/Riverware/staff/philw/WinQt5Port3/Sim
    -IC:/Riverware/staff/philw/WinQt5Port3/Units
    -IC:/Riverware/staff/philw/WinQt5Port3/Utils
    -IC:/Riverware/staff/philw/WinQt5Port3/VCXX
    -IC:/RiverWare/tools/RdfToExcel_Qt-551/include
    -IC:/RiverWare/tools/Qwt-612_Qt-551/src
    -IC:/RiverWare/tools/RepriseLM-12.0
    -IC:/RiverWare/tools/CPLEX-125/cplex/include
    -IC:/RiverWare/tools/CPLEX-125/concert/include
    -IC:/RiverWare/tools/Stubs/include
    -IC:/RiverWare/tools/tcl-8.6.4/generic
    -IC:/RiverWare/tools/gdal-1.9.2/include
    -IC:/RiverWare/tools/netCDF-4.3.2/include
    -IC:/Riverware/tools/Quazip-0.7.1_Qt-551
    -IC:/RiverWare/tools/protobuf-2.6.0/include
    -IC:/RiverWare/tools/icu-55.1/include
    -IC:/Riverware/tools/Qt-551/qtbase/src/3rdparty/zlib
    -IC:/RiverWare/tools/flexlm
    -IC:/RiverWare/tools/Oracle-12c/include
    -IC:/Riverware/tools/Qt-551/qtwebkit/include
    -IC:/Riverware/tools/Qt-551/qtwebkit/include/QtWebKitWidgets
    -IC:/Riverware/tools/Qt-551/qtbase/include
    -IC:/Riverware/tools/Qt-551/qtbase/include/QtWebKitWidgets
    -IC:/Riverware/tools/Qt-551/qtwebkit/include/QtWebKit
    -IC:/Riverware/tools/Qt-551/qtbase/include/QtWebKit
    -IC:/Riverware/tools/Qt-551/qtbase/include/QtPrintSupport
    -IC:/Riverware/tools/Qt-551/qtbase/include/QtWidgets
    -IC:/Riverware/tools/Qt-551/qtbase/include/QtGui
    -IC:/Riverware/tools/Qt-551/qtbase/include/QtNetwork
    -IC:/Riverware/tools/Qt-551/qtbase/include/QtXml
    -IC:/Riverware/tools/Qt-551/qtbase/include/QtConcurrent
    -IC:/Riverware/tools/Qt-551/qtbase/include/QtCore

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Missing qt/mocinclude.tmp file [Qt 5.5.1, Visual Studio 2010]

    - Do you have the Qt plugin for Visual Studio installed on the second machine?
    - Are all the paths the same on both machines?
    - Are the permissions and ownership of the GeneratedFiles directories correct?

    My MOC commands in the vcxproj files don't look very much like this. Here's an example from one of my projects (with some extra CRLF added for readability):

    Qt Code:
    1. <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
    2. "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp"
    3. -DUNICODE -DWIN32 -DWIN64 -DQT_DLL -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB
    4. "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore"
    5. "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets"
    6. </Command>
    To copy to clipboard, switch view to plain text mode 

    (This is likely from VS 2013, but the project files haven't changed much in recent versions of VS. I use an environment variable QT_DIR to point to the Qt distribution I am using for the build).

    I would suggest that you try the following experiment:

    - Do a "clean" without a rebuild
    - Remove one of your Qt GUI classes from the project (using the right-click "remove" in Solution Browser), .h, .cpp, and .ui if present.
    - Manually remove the generated files for it from the generated output directory if the clean didn't do it.
    - Do a build (which will probably fail because of the missing class.
    - Add the class files back in (Add existing item).
    - Save all.

    Examine the .vcxproj file and see what the MOC command for the newly-readded file looks like. If it is different from the original version, and trying to build the newly-added files succeeds, then you may have to do the same for all of the files for the QObject-based classes.

    I have found that sometimes Visual Studio just gets confused when dealing with MOC, and the easiest (but most tedious) method is to remove / add to fix the problem. As a first step, going into the GeneratedFIles directories and manually deleting everything in them sometimes works, too.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  3. #3
    Join Date
    Jun 2008
    Location
    Boulder, Colorado, USA
    Posts
    70
    Thanks
    16
    Thanked 1 Time in 1 Post
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Missing qt/mocinclude.tmp file [Qt 5.5.1, Visual Studio 2010]

    (I hadn't seen d_stranz's post before devising this work-around. See prior message. In any case -- THANKS SO MUCH for taking a look at this for us!)

    To solve (or really, work-around) this problem, we modified qtbase\mkspecs\features\moc.prf

    We first tried changing the name of the temporary include file mocinclude.tmp to mocinclude.opt (basically a patch that had been applied to Qt 5.6, I believe). That didn't help.

    We then commented out the generation and use of that include path file, forcing -I arguments to moc.exe to all be put right on the command line invocation of that program (i.e. regardless of how many of those arguments there were). That worked for us.

    Qt Code:
    1. # On Windows, put the includes into a .inc file which moc will read, if the project
    2. # has too many includes. We do this to overcome a command-line limit on Win < XP
    3. WIN_INCLUDETEMP=
    4.  
    5. # [Phil, 6-17-2016, skip the mocinclude file altogether]
    6. # win32:count(MOC_INCLUDEPATH, 40, >) {
    7. # WIN_INCLUDETEMP = $$MOC_DIR/mocinclude.opt
    8. #
    9. # WIN_INCLUDETEMP_CONT =
    10. # for (inc, MOC_INCLUDEPATH): \
    11. # WIN_INCLUDETEMP_CONT += -I$$inc
    12. # write_file($$absolute_path($$WIN_INCLUDETEMP, $$OUT_PWD), WIN_INCLUDETEMP_CONT)|error("Aborting.")
    13. # }
    To copy to clipboard, switch view to plain text mode 
    You must invoke qmake.exe on all Qt application project files after making this change to qtbase\mkspecs\features\moc.prf.

    Notice that the original comment indicates that this mocinclude provision was introduced to address a command-line size limit on Windows versions before "XP". However, Qt Technical Support mentions to me that it would technically be possible to exceed the larger command line size limit of subsequent Windows versions, so it's not technically true that this mocinclude provision would never be needed.

    We just couldn't get it to work for us. [Qt 5.5.1, Windows 8.1, Visual Studio 2010 Professional SP1]. The mocinclude.tmp (or .opt) file was absent (when we needed it to exist) when we attempted to build our application in Visual Studio. (See prior notes).

Similar Threads

  1. visual studio 2010 add-in 1.1.11 for Qt4
    By anh5kor in forum Newbie
    Replies: 1
    Last Post: 20th August 2015, 22:26
  2. Using Qt 5.4.1 Visual Studio 2013 libs in Visual Studio 2010
    By ^NyAw^ in forum Installation and Deployment
    Replies: 0
    Last Post: 6th March 2015, 10:20
  3. Qt and Visual Studio 2010
    By SixDegrees in forum Qt Programming
    Replies: 6
    Last Post: 15th November 2010, 19:56
  4. Visual Studio Plugin (1.1.6) crashes Visual Studio (2010)
    By mboeni in forum Installation and Deployment
    Replies: 0
    Last Post: 11th October 2010, 16:46
  5. Plan for Visual Studio 2010 (MSVC 2010)?
    By Vinzz in forum Qt Programming
    Replies: 1
    Last Post: 18th April 2010, 17:42

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.