Qt 5.4.1 : cannot find moc.exe



  • On a working Win7/Qt5.4.1 environnement, I suddenly have the following error :
    /usr/bin/sh: C:\Qt\Qt5.4.1\5.4\mingw491_32\bin\moc.exe: command not found

    When I look into this directory : C:\Qt\Qt5.4.1\5.4\mingw491_32\bin, the moc.exe binary file is there.

    I tried running the same command from command line, I got another error.
    Tried to uninstall/reinstall Qt5.4.1, I always have the same problem.

    Can anyone help me solve this issue, as I do not have any more idea to try by myself ?

    Thanks,

    Alain



  • I finally installed Qt 5.3.0 with mingw 4.8.2 (qt-opensource-windows-x86-mingw482_opengl-5.3.0) and it works with this version.
    I'd like to understand, as I did not make any change to my Qt / mingw setup before it was broken...



  • The only thing my eyes spot is the referenc to /usr/bin/sh. Of course in Win7 this leads to command not found. Are you cross-compiling for linux? A usr/bin/shshould never be in a Makefile on pure Windows qmake.



  • @sneubert
    Yes, it sounds strange to me also. I'm running Qt under a Win 7 computer.
    Maybe it is because I'm using a mingw compiler ?



  • @sneubert I checked again with Qt 5.4.1 (I've got both Qt 5.3.0 & Qt 5.4.1 installed on the same computer). Still have the same error


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    When do you have that error ?



  • @SGaist Hi, I get this error as soon as I use the build command.
    It started when I added a new SIGNAL/SLOT pair.
    But with the same code, it works under Qt 5.3.0 and does not under Qt 5.4.1 (but it used to)
    The difference between the 2 Qt versions is that Qt 5.4.1 uses mingw 4.9.1 instead of mingw 4.8.2
    I checked, the moc.exe file is in C:\Qt\Qt5.4.1\5.4\mingw491_32\bin\ directory ...


  • Lifetime Qt Champion

    Since it used to work, what did change in between ? Did you modify the Kits ?



  • @SGaist
    No, I don't think so.
    But I also think there has been many days between I previously ran moc.exe.
    In fact, I did not add any SIGNAL/SLOT since a very long time, so I didn't have to use the MOC
    So, maybe my configuration changed (but how ?)


  • Lifetime Qt Champion

    What do you mean by "there has been many days between I previously ran moc.exe." ? Did you run it manually ?



  • Sorry for the long delay.
    I'm just saying that I did not have to re-run moc.exe since I did not add any SIGNAL/SLOT nor touched the UI
    So, I just built the app using Ctrl-B


  • Lifetime Qt Champion

    That's the thing: you don't run moc, you re-run qmake that will in turn setup the targets to run moc when you hit the build button.


  • Moderators

    The /usr/bin/sh is more than likely the issue. It looks like you used a pseudo linux environment in windows (msys/msys2/cygwin?) at some point to run the qmake and now are possibly trying to run in a pure window (cmd) environment.

    I've done exactly that before where I had old Makefile's from when I used msys to build something, didn't clean up the build, and then tried with a pure cmd.

    If you are in a faux-linux environment then the paths with the backslashes are the issue in finding moc as they should be c:/x/x/x/x at a minimum or in a msys /c/Qt/.../moc.exe.

    Also I have seen issue with Qt claiming it can't find a binary when you have multiple versions of Qt installed and are mixing versions during a build. So check your pathing and QTDIR env var on that.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.