Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to use qmake for creating .pro files

How to use qmake for creating .pro files

Scheduled Pinned Locked Moved Solved General and Desktop
qmake
13 Posts 2 Posters 12.9k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • tomyT Offline
    tomyT Offline
    tomy
    wrote on last edited by tomy
    #1

    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?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      tomyT 1 Reply Last reply
      1
      • SGaistS 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.

        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.

        tomyT Offline
        tomyT Offline
        tomy
        wrote on last edited by tomy
        #3

        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.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          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.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • tomyT Offline
            tomyT Offline
            tomy
            wrote on last edited by tomy
            #5

            @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?

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              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.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0
              • tomyT Offline
                tomyT Offline
                tomy
                wrote on last edited by tomy
                #7

                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.

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  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
                  

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  1
                  • tomyT Offline
                    tomyT Offline
                    tomy
                    wrote on last edited by tomy
                    #9

                    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.

                    1 Reply Last reply
                    0
                    • SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on last edited by
                      #10

                      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.

                      Interested in AI ? www.idiap.ch
                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                      1 Reply Last reply
                      2
                      • tomyT Offline
                        tomyT Offline
                        tomy
                        wrote on last edited by
                        #11

                        Thank you very much. I really appreciate you.

                        1 Reply Last reply
                        0
                        • SGaistS Offline
                          SGaistS Offline
                          SGaist
                          Lifetime Qt Champion
                          wrote on last edited by
                          #12

                          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 :)

                          Interested in AI ? www.idiap.ch
                          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                          1 Reply Last reply
                          0
                          • tomyT Offline
                            tomyT Offline
                            tomy
                            wrote on last edited by
                            #13

                            @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. :-)

                            1 Reply Last reply
                            0

                            • Login

                            • Login or register to search.
                            • First post
                              Last post
                            0
                            • Categories
                            • Recent
                            • Tags
                            • Popular
                            • Users
                            • Groups
                            • Search
                            • Get Qt Extensions
                            • Unsolved