Adding to .Pro file (Qt)
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: Adding to .Pro file (Qt)

  1. #1
    Join Date
    Apr 2013
    Posts
    6

    Adding to .Pro file (Qt)

    I created a new project in Qt Creator, the files included are the .Pro file, and the .Cpp file.

    Qt does not recognize the headers I try to reference in the .Cpp file. I am pretty sure it's because of what I don't have in my .Pro file. What do I add to it?

    .Cpp

    Code:
    #include <QApplication>       ->No such File or Directory
    #include <QPushButton>         ->No such File or Directory
    #include <QHBoxLayout>          ->No such File or Directory
    
    int main(int argc, char *argv[])
    {
        QApplication app(argc, argv);
        QWidget *window = new QWidget;
        QPushButton *button = new QPushButton("Quit");
    
        QObject::connect(button, SIGNAL(clicked()),
                         &app, SLOT(quit()));
    
        button->show();
    
        QHBoxLayout *layout = new QHBoxLayout;
    
        window->setLayout(layout);
        window->show();
    
        return app.exec();
    
    
    }
    .Pro
    Code:
    SOURCES += \
        MainWindow.cpp
    Last edited by Zyrion; June 4th, 2013 at 07:03 PM.

  2. #2
    Join Date
    Aug 2000
    Location
    West Virginia
    Posts
    7,637

    Re: Adding to .Pro file (Qt)

    Try adding the following to the top of the pro file:

    QT += core gui widgets



    and also run qmake

    (From main window, choose "build" menu item ... then "run qmake"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center