How to use qmake for creating .pro files



  • Hi all,

    I installed Qt creator IDE v. 5.5.1 (Qt Creator (Community)) and also installed Qt Creator 3.6.0 on my Windows 64-bit machine. But I use only the Qt Creator 3.6.0 one for creating apps because it’s said to have more features compared to the Qt Creator IDE v. 5.5.1 (Qt Creator (Community)) one.

    I've created a Form (using File > New File or Project > Qt > Qt Designer Form > Choose > Widgets ) by Qt Creator 3.6.0.
    Then I created the .h, .cpp and main.cpp files using again Qt Creator 3.6.0. Now all the four files (.ui, .h, .cpp and main.cpp) have their codes and are in a folder.
    Now is the time to make a .pro file for them to be able to run the project. How to do it please?


  • Lifetime Qt Champion

    Hi,

    The most simple way would have been to create a new widget application. This way you would have everything ready from the start.

    Back to your question, one way is to go the folder where the code is contained using the command line then call qmake -project to create the project file.



  • Hello @SGaist

    Hi,

    The most simple way would have been to create a new widget application. This way you would have everything ready from the start.

    Do you mean that then I need to copy and paste the contents of those four files into new files?

    Back to your question, one way is to go the folder where the code is contained using the command line then call qmake -project to create the project file.

    From Start menu I chose cmd and using cd commands I went to the folder where those four files are there. Then I typed qmake -project. I got the following message!
    'qmake' is not recognized as an internal or external command,
    operable program or batch file.


  • Lifetime Qt Champion

    No, I mean that you can avoid creating them by hand since Qt Creator offers the possibility to create them for you. You can very well add them to a project without copying them.

    That's normal, you should use the full path to your qmake version.



  • @SGaist said:

    That's normal, you should use the full path to your qmake version.

    Thanks for your replies. But please have a look at this and this screenshots.
    Where did I go wrong please?


  • Lifetime Qt Champion

    You are calling qmake without giving the full path to qmake as in C:\Qt\5.5\msvc_2013\bin\qmake.

    IIRC you might also have the option to open a pre-populated command line from Qt's entry in the start menu. That way you will have a console ready to be used.



  • My qmake.exe file is in the bin folder in the following path:
    C:\Qt\Qt5.5.1\5.5\mingw492_32\bin
    I retried using qmake here and apparently it succeeded but the project myqtapp doesn't still contain a .pro file and Run triangle is still grayed out.
    It's here.

    But please bear in mind that I've installed two Qt Creator IDEs:
    Qt creator IDE v. 5.5.1 (Qt Creator (Community))
    and also Qt Creator 3.6.0

    And I use Qt Creator 3.6.0 and the path above (to me) belongs to Qt creator IDE v. 5.5.1 not Qt Creator 3.6.0! That's why no changes in the project happen.


  • Lifetime Qt Champion

    I meant: from the folder where you files are, call qmake with the full path:

    cd C:\Users\CS\Documents\Qt\Forms\
    C:\Qt\Qt5.5.1\5.5\mingw492_32\bin\qmake -project
    


  • It worked!! Great :-)
    Thank you very much. You solved the issue I was involving in for days. Thanks so much. :-)

    And just for sureness:
    After qmake, I double clicked on the .pro file made. It took me to a page "configure project". I clicked on the "configure" button there. Then CTRL+R.

    An error: while building/deploying project from (kit: Desktop)
    I went to: Tools > Options > Build & Run > Kits > Compiler: (here I chose MinGW 4.9.2 32-bit ) > OK
    Then CTRL+R

    Another error:
    C:\Users\CS\Documents\Qt\Forms\main.cpp:1: error: QApplication: No such file or directory
    #include <QApplication>
    ^

    Probably it's of the codes and has nothing to do with the work qmake done.
    If I cannot solve this issue, I try to post this in another thread.


  • Lifetime Qt Champion

    You need to edit the .pro file and add QT += widgets. The project functionality generates a "skeleton" that you have to adjust a bit depending on what you used in your code.



  • Thank you very much. I really appreciate you.


  • Lifetime Qt Champion

    You're welcome !

    Since you have it working now, please mark the thread as solved using the "Topic Tool" button so that other forum users may know a solution has been found :)



  • @SGaist said:

    You're welcome !

    Since you have it working now, please mark the thread as solved using the "Topic Tool" button so that other forum users may know a solution has been found :)

    Sure. Thanks again. :-)


Log in to reply
 

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