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 do you set up your .pro file with Qt Tools for Visual Studio?
Forum Updated to NodeBB v4.3 + New Features

How do you set up your .pro file with Qt Tools for Visual Studio?

Scheduled Pinned Locked Moved Solved General and Desktop
6 Posts 3 Posters 2.1k Views 2 Watching
  • 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.
  • enjoysmathE Offline
    enjoysmathE Offline
    enjoysmath
    wrote on last edited by
    #1

    22c30bf0-9051-48e6-a1d5-003bcac3af29-image.png

    The screenshot shows that I tried copying over some of the QtCreator .pro file side to the VS side. In VS I right-clicked the project, there's a context menu folder for Qt, and within it is "Create .pro file". So I did that and edited that, but I don't think VS is using the .pro file in the build! So what is the point of the create .pro file....

    Anyway, how did you end up getting your Qt app to build? Mine uses webenginewidgets, which is one of the reasons I wanted the .pro file on the VS side.

    Here's currently the generated .pro file with my edits:

    # ----------------------------------------------------
    # This file is generated by the Qt Visual Studio Tools.
    # ------------------------------------------------------
    
    TEMPLATE = app
    TARGET = AbstractSpacecraft
    DESTDIR = ./x64/Debug
    CONFIG += debug
    LIBS += -L"."
    DEPENDPATH += .
    MOC_DIR += .
    OBJECTS_DIR += debug
    UI_DIR += .
    RCC_DIR += .
    include(AbstractSpacecraft.pri)
    win32:RC_FILE = AbstractSpacecraft.rc
    
    QT       += core gui
    
    QT += webenginewidgets webchannel
    
    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
    
    CONFIG += c++17
    
    PRECOMPILED_HEADER = precompiledheader.pch
    CONFIG += precompile_header
    

    https://github.com/enjoysmath
    https://math.stackexchange.com/users/26327/exercisingmathematician

    1 Reply Last reply
    0
    • enjoysmathE Offline
      enjoysmathE Offline
      enjoysmath
      wrote on last edited by
      #3

      https://stackoverflow.com/a/5234347/7076615

      I think that is the issue. In Qt Creator you don't include the PCH everywhere, in VS you have to!

      https://github.com/enjoysmath
      https://math.stackexchange.com/users/26327/exercisingmathematician

      1 Reply Last reply
      0
      • enjoysmathE Offline
        enjoysmathE Offline
        enjoysmath
        wrote on last edited by
        #2

        Now, I've figured out on my own that you're supposed to add in Qt modules using the VS C++ build settings under "Additional Qt modules". There's a Select Qt modules and a GUI pops up with checkable boxes and the Qt logo on each checkbox. WebEngine Widgets, etc was there. So I deleted my .pri, .pro files and now having issues with the precompiled header. So we're getting somewhere!

        bc2f5d67-bc6f-4044-ac3d-d6e402e2218d-image.png

        It says we forgot to add "#include "stdafx.h"" to the source code, but it's right at the top of main.cpp.

        I will try adding back in the .pro file again and assigning precompiled header there as well. Has anyone encountered this hurdle?

        https://github.com/enjoysmath
        https://math.stackexchange.com/users/26327/exercisingmathematician

        1 Reply Last reply
        0
        • enjoysmathE Offline
          enjoysmathE Offline
          enjoysmath
          wrote on last edited by
          #3

          https://stackoverflow.com/a/5234347/7076615

          I think that is the issue. In Qt Creator you don't include the PCH everywhere, in VS you have to!

          https://github.com/enjoysmath
          https://math.stackexchange.com/users/26327/exercisingmathematician

          1 Reply Last reply
          0
          • enjoysmathE Offline
            enjoysmathE Offline
            enjoysmath
            wrote on last edited by
            #4

            OMG! It works now! ;-)

            6283ccea-ddd2-455a-aa81-9ec648a59844-image.png

            And it runs promptly. I think I will like debugging in VS more than in Qt Creator.

            https://github.com/enjoysmath
            https://math.stackexchange.com/users/26327/exercisingmathematician

            S 1 Reply Last reply
            1
            • enjoysmathE enjoysmath

              OMG! It works now! ;-)

              6283ccea-ddd2-455a-aa81-9ec648a59844-image.png

              And it runs promptly. I think I will like debugging in VS more than in Qt Creator.

              S Offline
              S Offline
              SimonSchroeder
              wrote on last edited by
              #5

              @enjoysmath said in How do you set up your .pro file with Qt Tools for Visual Studio?:

              I think I will like debugging in VS more than in Qt Creator.

              The standalone Microsoft debugger is horrible. I mostly use VS for debugging on Windows. Qt Creator can only be used on smaller projects with tiny data for debugging. Still, we are using .pro files as a basis as we compile on different platforms. qmake can generate a VS project from your .pro file automatically. Only the dependencies in the resulting VS project are not perfect.

              I guess the future is CMake. It's portable and both Qt Creator and VS understand it. (But, it requires Qt 6.)

              SGaistS 1 Reply Last reply
              1
              • S SimonSchroeder

                @enjoysmath said in How do you set up your .pro file with Qt Tools for Visual Studio?:

                I think I will like debugging in VS more than in Qt Creator.

                The standalone Microsoft debugger is horrible. I mostly use VS for debugging on Windows. Qt Creator can only be used on smaller projects with tiny data for debugging. Still, we are using .pro files as a basis as we compile on different platforms. qmake can generate a VS project from your .pro file automatically. Only the dependencies in the resulting VS project are not perfect.

                I guess the future is CMake. It's portable and both Qt Creator and VS understand it. (But, it requires Qt 6.)

                SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #6

                @SimonSchroeder cmake also supports Qt 5.

                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

                • Login

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