Important: Please read the Qt Code of Conduct -

How to indicate INCLUDE PATH to QT CREATOR

  • Hi everybody,

    I'm sorry for the question, I know is a simnple question but I don´t find the solution.

    The thing is :

    I'm working with QT CREATOR 2.5.2 and QT 4.8.0, also I'm working with PCL (Point cloud library 1.6.0). I'm programming onto Windows 7 64 bits. I create a simple form with a button using the QT creator and everything works fine, but if I want to include a header file, the QT Creator doesn´t find the header file.

    I edited the .pro file, and I use the INCLUDEPATH += indicate the path but the QT Creator doesn´t find the header file.

    my cpp file is :

    #include "mainwindow.h"
    #include "ui_mainwindow.h"
    #include "point_types.h"

    MainWindow::MainWindow(QWidget *parent) :
    ui(new Ui::MainWindow)

    delete ui;

    I'm not find the way to say to the QT Creator which is the include PATH, in this case "c:\Program Files\PCL 1.6.0\include"

    Please, anyone can help me, I'm really fustrated.

    Advanced thanks

  • Hi, if INCLUDEPATH doesn't seem to work, you can always specify the path in the #include, like this:
    #include "C:/Program Files/PCL 1.6.0/Include/point_types.h"

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    You should use forward slashes and also check whether the includes are in the root path of the library.

  • Thanks to everybody for the replies,

    Yes, if I put the absolute path in the include it works, so in my complete project developed with MSVS C++ and QT designer (not qt creator) I have thousans includes in hundreds files, is imposible to change all.

    And regarding forward slashes I proved everything, forward, backward, ..., I start to think is a problem with the QT creator version.

    Thank you

  • Hi again,

    I found the error, if my path has a space, INCLUDEPATH is not efective, so I have everything installed inside "Program Files".

    Any suggestion ?

    Thanks !!!!!

  • Hi, the "spaces" syndrome you can cure in your .pro file by defining a variable which you then assign to the includepath, like this:
    PCLINCLUDE = "c:/Program Files/PCL 1.6.0/include"
    (Note that Qt is more happy with forward slashes in the directory names.)

  • Thanks !!!

    Now everything is working

  • Lifetime Qt Champion

    There's also

    @INCLUDEPATH += $$quote(c:/Program Files/PCL 1.6.0/include)@

  • Yeah SGaist that one is better/shorter.

Log in to reply