user1465557
user1465557

Reputation: 349

Including QT packages

I have a directory in my home directory as qt-everywhere-opensource-src-4.8.2. This directory contains the basic QT packages and all but the problem is that when i compile a normal Qt file present in the home directory it shows error that the respective QT packages are not found.however,when i try to compile a normal c file by gcc and c++ file by g++ then it gives no error. All i want is to know that how can i include those packages present in the directory. My file which i am trying to compile is :-

#include <QApplication>
#include <QWidget>

   int main(int argc, char *argv[])
{
    QApplication app(argc, argv);

    QWidget window;

    window.resize(250, 150);
    window.setWindowTitle("Simple example");
    window.show();

    return app.exec();
}

ERRORS =

demo.cpp:1:24: error: QApplication: No such file or directory
demo.cpp:2:19: error: QWidget: No such file or directory
demo.cpp: In function âint main(int, char**)â:
demo.cpp:6: error: âQApplicationâ was not declared in this scope
demo.cpp:6: error: expected â;â before âappâ
demo.cpp:8: error: âQWidgetâ was not declared in this scope
demo.cpp:8: error: expected â;â before âwindowâ
demo.cpp:10: error: âwindowâ was not declared in this scope
demo.cpp:14: error: âappâ was not declared in this scope

Upvotes: 0

Views: 1064

Answers (1)

hank
hank

Reputation: 9873

You should add this line to your .pro file: QT += core gui

Upvotes: 1

Related Questions