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. QT error: invalid use of incomplete type 'class QNetworkProxy'
QtWS25 Last Chance

QT error: invalid use of incomplete type 'class QNetworkProxy'

Scheduled Pinned Locked Moved Unsolved General and Desktop
7 Posts 2 Posters 2.3k 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.
  • C Offline
    C Offline
    coding-jewelry
    wrote on last edited by
    #1

    Hi there, I am currently having a problem like the following.

    src/qt/optionsmodel.cpp: In member function 'bool OptionsModel::getProxySettings(QNetworkProxy&) const':
    src/qt/optionsmodel.cpp:342:18: error: invalid use of incomplete type 'class QNetworkProxy'
    proxy.setType(QNetworkProxy::Socks5Proxy);
    ^
    In file included from src/qt/optionsmodel.cpp:4:0:
    src/qt/optionsmodel.h:14:7: error: forward declaration of 'class QNetworkProxy'
    class QNetworkProxy;
    ^
    src/qt/optionsmodel.cpp:342:27: error: incomplete type 'QNetworkProxy' used in nested name specifier
    proxy.setType(QNetworkProxy::Socks5Proxy);
    ^
    src/qt/optionsmodel.cpp:343:18: error: invalid use of incomplete type 'class QNetworkProxy'
    proxy.setHostName(QString::fromStdString(curProxy.first.ToStringIP()));
    ^
    In file included from src/qt/optionsmodel.cpp:4:0:
    src/qt/optionsmodel.h:14:7: error: forward declaration of 'class QNetworkProxy'
    class QNetworkProxy;
    ^
    src/qt/optionsmodel.cpp:344:18: error: invalid use of incomplete type 'class QNetworkProxy'
    proxy.setPort(curProxy.first.GetPort());
    ^
    In file included from src/qt/optionsmodel.cpp:4:0:
    src/qt/optionsmodel.h:14:7: error: forward declaration of 'class QNetworkProxy'
    class QNetworkProxy;
    ^
    src/qt/optionsmodel.cpp:352:14: error: invalid use of incomplete type 'class QNetworkProxy'
    proxy.setType(QNetworkProxy::NoProxy);
    ^
    In file included from src/qt/optionsmodel.cpp:4:0:
    src/qt/optionsmodel.h:14:7: error: forward declaration of 'class QNetworkProxy'
    class QNetworkProxy;
    ^
    src/qt/optionsmodel.cpp:352:23: error: incomplete type 'QNetworkProxy' used in nested name specifier
    proxy.setType(QNetworkProxy::NoProxy);

    Actually the line #include <QNetworkProxy> has been already existing in optionsmodel.cpp.
    And in optionsmodel.h, the following lines are already existing.
    QT_BEGIN_NAMESPACE
    class QNetworkProxy;
    QT_END_NAMESPACE

    It's an open source project, so I thought that it will be built without any error. But unfortunately it occurs the error and I am not sure how to fix it because I am not familiar with QT.
    My QT version is 5.8.

    Can you please let me know how I can overcome this problem?
    Thanks.

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

      Hi and welcome to devnet,

      Did you forget the include statement in your optionsmodel.cpp file ?
      If not, did you also add QT += network in your .pro file ?

      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
      • C Offline
        C Offline
        coding-jewelry
        wrote on last edited by
        #3

        Hi SGaist, thanks for your reply.
        As I mentioned, #include <QNetworkProxy> was already added in the .cpp file.
        And, QT += core gui widgets network printsupport was also added in the .pro file.

        I am really not sure why it can't be compiled. Actually I am not a QT developer, so I have no idea how I can overcome this.
        Can you please give me any hint?

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

          My bad, I misread that part.

          Did you re-run qmake after adding network to the QT variable and before building your project ?

          By the way, the framework's name is Qt, QT stands for Apple's QuickTime.

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

          C 3 Replies Last reply
          1
          • SGaistS SGaist

            My bad, I misread that part.

            Did you re-run qmake after adding network to the QT variable and before building your project ?

            By the way, the framework's name is Qt, QT stands for Apple's QuickTime.

            C Offline
            C Offline
            coding-jewelry
            wrote on last edited by
            #5

            Actually I have re-ran qmake many many times, but all are failed in that part.
            It is an open source project, so I thought that it will be worked exactly without any error.
            You can see it on Github: https://github.com/martexcoin/martexcoin
            And the files are:
            [https://github.com/martexcoin/martexcoin/blob/master/src/qt/optionsmodel.h](link url)
            [https://github.com/martexcoin/martexcoin/blob/master/src/qt/optionsmodel.cpp](link url)

            Project file is: [https://github.com/martexcoin/martexcoin/blob/master/martex.pro](link url)

            The steps to build that I have tried:
            qmake martex.pro -r -spec win32-g++ "CONFIG+=release" USE_UPNP=0 USE_QRCODE=1 USE_IPV6=1
            make clean
            cd src/leveldb
            make TARGET_OS=OS_WINDOWS_CROSSCOMPILE clean
            make TARGET_OS=OS_WINDOWS_CROSSCOMPILE libleveldb.a libmemenv.a
            cd ../..
            make release

            I think that all dependencies are setup correctly.

            1 Reply Last reply
            0
            • SGaistS SGaist

              My bad, I misread that part.

              Did you re-run qmake after adding network to the QT variable and before building your project ?

              By the way, the framework's name is Qt, QT stands for Apple's QuickTime.

              C Offline
              C Offline
              coding-jewelry
              wrote on last edited by
              #6

              Hi @SGaist , so what do you think is wrong?

              1 Reply Last reply
              0
              • SGaistS SGaist

                My bad, I misread that part.

                Did you re-run qmake after adding network to the QT variable and before building your project ?

                By the way, the framework's name is Qt, QT stands for Apple's QuickTime.

                C Offline
                C Offline
                coding-jewelry
                wrote on last edited by
                #7

                @SGaist , maybe if you have any spare time, can we do Skype? I can share my screen, so you will be able to what is going now.
                Of course I am willing to compensate you for this problem. Please let me know your Skype ID if you agree, or you can find me: Anatoly.Halfin.RSH

                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