[Solved] Simple Makefile without qmake

  • Dear All,

    I generally use qmake for qt projects. But now i want to integrate QT with my old project. So i want to learn how to create the Makefile without using qmake.

    Lets suppose i have few lines of code:

    #include <QApplication>
    #include <QLabel>

    int main (int argc, char *argv[])
    QApplication app(argc, argv);
    QLabel *label = new QLabel("Hello World");
    return app.exec();

    For the above lines Q_Object Macro is not needed so there is no need of doing moc.
    So my simple question is how should i write the makefile to compile the above lines?

    We need to include LIBS like -lQt5Core -lQt5Gui, lQt5Widgets. Apart from this we also need to include one include folder.

    Kindly let me know what else we need.

    Looking forward for the quick help.

    Thanks a lot.

  • Moderators

    If you want a quick solution: generate the Makefile with qmake (once) and then strip it off the things you don't need (there will be a lot of code there).

  • Dear Sierdzio, thanks a lot for the pointer. It worked!!

  • Moderators

    Hey, I'm glad to hear that. Happy coding!

Log in to reply

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