Important: Please read the Qt Code of Conduct -

Why do I get qmake 4.8 in Qt5.0.1 ?

  • Hi,
    I downloaded and installed Qt5.0.1 for linux64. However the qmake I got is version 4.8? It's causing problems like

    error: #error "This file was generated using the moc from 4.8.1. It"
    error: #error "cannot be used with the include files from this version of Qt."

    Does anyone have the same problem? Where can I get qmake 5.0? Any help is appreciated.

  • When you type:

    the system uses a PATH to find an executable called "qmake" and it runs the first one it finds. In your case this is likely to be the system version of Qt... Qt 4.8. Type:
    which qmake

    to see what I mean. Either put the Qt 5.0.1 bin directory in earlier in the path than whatever directory (probably /usr/bin) contains the Qt 4.8 version of qmake, or deliberately spell out the full location of the qmake tyou want to run:

  • If you use Qt Creator, you can select a desired kit. No manual work is needed then.

  • I think the question you ask does not match the error message you post.

    The error indicates you have a header file that moc from 4.8 generated that you try to compile.

    You need to make sure all the moc files are regenerated. Try a 'make clean'

  • Otherwise through away the entire "debug and release" directories. Then do a qmake build (this will as Thomas indicated) to regenerate all desired files.
    That should do the trick.

  • Thank you very much, guys. The problem is indeed as Chris suggested, that I have another qmake in /usr/bin, which is version 4.8. And when I call qmake, this qmake 4.8 generates the moc files.

Log in to reply