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 Update on Monday, May 27th 2025

Cannot create object of QNetworkAccessManager

Scheduled Pinned Locked Moved Solved Qt Creator and other tools
7 Posts 3 Posters 90 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 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?

    Christian EhrlicherC jsulmJ 2 Replies Last reply
    0
    • Y YamiTheWitch

      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?

      Christian EhrlicherC Online
      Christian EhrlicherC Online
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote 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

        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?

        jsulmJ Online
        jsulmJ Online
        jsulm
        Lifetime Qt Champion
        wrote 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
        0
        • jsulmJ jsulm

          @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 last edited by
          #4

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

          jsulmJ 1 Reply Last reply
          0
          • Y YamiTheWitch

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

            jsulmJ Online
            jsulmJ Online
            jsulm
            Lifetime Qt Champion
            wrote last edited by
            #5

            @YamiTheWitch What about my question?

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

            Y 1 Reply Last reply
            0
            • jsulmJ jsulm

              @YamiTheWitch What about my question?

              Y Offline
              Y Offline
              YamiTheWitch
              wrote 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.

              jsulmJ 1 Reply Last reply
              0
              • Y YamiTheWitch

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

                jsulmJ Online
                jsulmJ Online
                jsulm
                Lifetime Qt Champion
                wrote 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

                • Login

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