[Qt 5.3.1] Issue to to find its own source files



  • Hey guys I am currently trying to compile and build a project which I believe was done on Qt 4.x.x, but I'm not really sure.
    The problem is that all Qt internal source files are having problems to find each other, basically they cannot find themselves if they are declared inside their respective folder, but when I remove the folder path and just keep the file name it works, but I don't think I'm supposed to do changes on these includes. Let me give an example to explain myself better:

    Error: @ opt/Qt5.3.1/5.3/gcc_64/include/QtGui/qguiapplication.h:45
    error: QtCore/qcoreapplication.h: No such file or directory
    #include <QtCore/qcoreapplication.h>
    @

    However, when remove the QtCore/ folder from the include leaving just #include <qcoreapplication.h> it manages to find the file. I suspect this is something that should be changed or added to the pro file, but I have no idea what. Anyway I'm attaching the pro file here so you guys can take a look as well.

    @QT += core gui
    QT += widgets

    CONFIG += qt

    TARGET = visor
    TEMPLATE = app

    SOURCES += main.cpp\
    mainwindow.cpp \
    imagestitcher.cpp \
    objectrecognizer.cpp \
    sharedfunctions.cpp \
    customgraphicsview.cpp \
    customslider.cpp \
    metadataparser.cpp

    HEADERS += mainwindow.h \
    imagestitcher.h \
    objectrecognizer.h \
    sharedfunctions.h \
    customgraphicsview.h \
    customslider.h \
    metadataparser.h

    FORMS += mainwindow.ui

    INCLUDEPATH += pkg-config --cflags opencv

    LIBS += -L/usr/local/lib
    LIBS += pkg-config --libs opencv

    @

    I though on removing all the folder all includes but there is simply a huge amount of Qt source files and it seems quite a incorrect way to solve the issue.


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Can you show an example of the include used in the project ? e.g. from customslider

    On a side note, you can simplify the OpenCV handling with

    @
    CONFIG += link_pkgconfig
    PKGCONFIG += opencv@



  • Sure, all the mess along Qt's internal source files starts when I call include QGuiApplication in my main.cpp:

    @
    #include <QGuiApplication>
    #include "mainwindow.h"

    int main(int argc, char *argv[])
    {
    QApplication a(argc, argv);
    MainWindow w;
    w.show();

    return a.exec()
    }
    @

    BTW Thx for the side note :)


  • Lifetime Qt Champion

    Looks strangeā€¦ How did you install Qt ?


  • Moderators

    I bet when you set the prefix during the Qt build it was something that caused this problem.

    Can you post the result of:

    @
    qmake -query
    @

    And where is your Qt located, full path to the include directory.

    If my guess is right on this you can fix the path with a qt.conf file in your bin directory. I can give you the syntax for the file once I see your path and variables from qmake -query.


Log in to reply
 

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