QtCreator and CMake: includes not found on OS X



  • I have problems with latest QtCreator 3.0, Qt 5.2 and CMake project on OS X Mavericks.

    My project uses Qt includes in a form #include <module/class>, for example:
    @#include <QtCore/QTimer>
    #include <QtGui/QMouseEvent>
    #include <QtWidgets/QHBoxLayout>
    #include <QtWidgets/QLabel>
    #include <QtWidgets/QSlider>@

    None of these includes are found by QtCreator's editor so I get include warnings and cannot use autocomplete and code is not highlighted.

    I already tried reinstalling QtCreator and Qt, deleting config files, creating dummy project and nothing helped. Any ideas?


  • Moderators

    Creator gets the list of include directories from cmake. So did you configure Qt correctly there? Creator does not apply any of its settings to CMake. So the Qt selected in the Kit you are using is not communicated to cmake, neither is the compiler, etc. You unfortunately have to do this yourself.

    Having said this: If the project builds, then the headers should also be found by Creator. So does it build?



  • The project builds successfully. I use recommended Qt5 macros for CMake. The same issue occurs with a new hello world project.

    There may be a bug in Creator which makes new Qt5 macros incompatible with it's parsing of cmake files/cache. I can fix the issue with manually applying include directories for each Qt module.


Log in to reply
 

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