Results 1 to 2 of 2

Thread: How to convert the project in Qt creator to a single c/cpp file?

  1. #1
    Join Date
    Mar 2013
    Posts
    1
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Unix/X11

    Default How to convert the project in Qt creator to a single c/cpp file?

    Hi,
    I want to know if its possible to make my project created through Qt creator into a single file and if so how do i go about it? I have seen examples like
    [code]#include <QApplication>
    #include <QPushButton>

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

    QPushButton btn("Hello World");
    btn.show();
    btn.showMaximized();

    return app.exec();
    }
    When creating a project using the creator we get a main.cpp, mainwindow.cpp, mainwindow.h, etc. right? How can I include all of these into a single main.cpp like the code shown and then use qmake and make from the terminal for executing?
    Any help is appreciated...
    Regards,
    Kiran

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to convert the project in Qt creator to a single c/cpp file?

    It is possible but for a larger project I don't see any reason to do that. If you really want to then copy all content to a single file, add a #include "main.moc" statement just before the main function or at the end of the file, run qmake and build the project.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Replies: 1
    Last Post: 25th October 2012, 12:42
  2. Single Log File for Qt Project.
    By qtlinuxnewbie in forum Newbie
    Replies: 5
    Last Post: 16th February 2010, 13:00
  3. HELP!!!Qt Creator can not open project file
    By zhouxf in forum Qt Tools
    Replies: 7
    Last Post: 22nd May 2009, 09:56
  4. Replies: 2
    Last Post: 16th April 2008, 10:31
  5. one single project file for Qt/Qtopia Core/QPE
    By izico in forum Qt for Embedded and Mobile
    Replies: 8
    Last Post: 27th June 2007, 07:27

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.