Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Cannot create object of QNetworkAccessManager
Forum Updated to NodeBB v4.3 + New Features

Cannot create object of QNetworkAccessManager

Scheduled Pinned Locked Moved Solved Qt Creator and other tools
7 Posts 3 Posters 215 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.
  • Y Offline
    Y Offline
    YamiTheWitch
    wrote on 8 May 2025, 13:33 last edited by
    #1

    I am using QT 6.9.0 and am on windows with MSVC2022.

    I can include QNetworkAccessManager with:

    #include <QtNetwork/QNetworkAccessManager>
    

    And I can declare a variable just fine:

    QNetworkAccessManager* manager;
    

    However when trying to call in my application constructor:

    manager = new QNetworkAccessManager(this);
    

    I get a bunch of linking errors.

    Is there any common known issue with QNetworkAccessManager on Windows or do I need to configure something to make this work?

    C J 2 Replies Last reply 8 May 2025, 13:42
    0
    • Y YamiTheWitch
      8 May 2025, 13:33

      I am using QT 6.9.0 and am on windows with MSVC2022.

      I can include QNetworkAccessManager with:

      #include <QtNetwork/QNetworkAccessManager>
      

      And I can declare a variable just fine:

      QNetworkAccessManager* manager;
      

      However when trying to call in my application constructor:

      manager = new QNetworkAccessManager(this);
      

      I get a bunch of linking errors.

      Is there any common known issue with QNetworkAccessManager on Windows or do I need to configure something to make this work?

      C Offline
      C Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on 8 May 2025, 13:42 last edited by
      #2

      @YamiTheWitch said in Cannot create object of QNetworkAccessManager:

      I get a bunch of linking errors

      You must also link against the network library.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      0
      • Y YamiTheWitch
        8 May 2025, 13:33

        I am using QT 6.9.0 and am on windows with MSVC2022.

        I can include QNetworkAccessManager with:

        #include <QtNetwork/QNetworkAccessManager>
        

        And I can declare a variable just fine:

        QNetworkAccessManager* manager;
        

        However when trying to call in my application constructor:

        manager = new QNetworkAccessManager(this);
        

        I get a bunch of linking errors.

        Is there any common known issue with QNetworkAccessManager on Windows or do I need to configure something to make this work?

        J Offline
        J Offline
        jsulm
        Lifetime Qt Champion
        wrote on 8 May 2025, 13:43 last edited by
        #3

        @YamiTheWitch Did you modify your pro or CMakeLists.txt file like shown in https://doc.qt.io/qt-6/qnetworkaccessmanager.html ?
        Also, then you say you get errors you should also post them, else nobody knows what errors you get.

        https://forum.qt.io/topic/113070/qt-code-of-conduct

        Y 1 Reply Last reply 8 May 2025, 13:44
        0
        • J jsulm
          8 May 2025, 13:43

          @YamiTheWitch Did you modify your pro or CMakeLists.txt file like shown in https://doc.qt.io/qt-6/qnetworkaccessmanager.html ?
          Also, then you say you get errors you should also post them, else nobody knows what errors you get.

          Y Offline
          Y Offline
          YamiTheWitch
          wrote on 8 May 2025, 13:44 last edited by
          #4

          @jsulm 071faac2-481f-4c41-84c1-5e4d7fd71957-image.png

          J 1 Reply Last reply 8 May 2025, 13:45
          0
          • Y YamiTheWitch
            8 May 2025, 13:44

            @jsulm 071faac2-481f-4c41-84c1-5e4d7fd71957-image.png

            J Offline
            J Offline
            jsulm
            Lifetime Qt Champion
            wrote on 8 May 2025, 13:45 last edited by
            #5

            @YamiTheWitch What about my question?

            https://forum.qt.io/topic/113070/qt-code-of-conduct

            Y 1 Reply Last reply 8 May 2025, 14:03
            0
            • J jsulm
              8 May 2025, 13:45

              @YamiTheWitch What about my question?

              Y Offline
              Y Offline
              YamiTheWitch
              wrote on 8 May 2025, 14:03 last edited by
              #6

              @jsulm Oh, adding the cmake lines worked, thanks! Doesn't Qt automatically change the cmake file? Or is that only on project creation? Also I would have loved to reply quicker but there is a 10 minute cooldown for members that don't have at least 1 reputation point.

              J 1 Reply Last reply 8 May 2025, 14:06
              0
              • Y YamiTheWitch
                8 May 2025, 14:03

                @jsulm Oh, adding the cmake lines worked, thanks! Doesn't Qt automatically change the cmake file? Or is that only on project creation? Also I would have loved to reply quicker but there is a 10 minute cooldown for members that don't have at least 1 reputation point.

                J Offline
                J Offline
                jsulm
                Lifetime Qt Champion
                wrote on 8 May 2025, 14:06 last edited by
                #7

                @YamiTheWitch said in Cannot create object of QNetworkAccessManager:

                Doesn't Qt automatically change the cmake file?

                Qt is a C++ framework.
                QtCreator would be responsible for the build tools. But it would have to parse your code to figure out what modules you're using to and them to CMakeLists.txt file then.

                https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                0
                • Y YamiTheWitch has marked this topic as solved on 8 May 2025, 15:05

                4/7

                8 May 2025, 13:44

                • Login

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