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. QNetworkRequest problem
Forum Updated to NodeBB v4.3 + New Features

QNetworkRequest problem

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 3.9k Views 1 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.
  • U Offline
    U Offline
    uzi17
    wrote on last edited by
    #1

    hey im new to QT.

    im trying to load html from a url and i get an error on just the first line

    My guess is that i haven't set up QTCreator correctly?

    The code that is causing the error is this 1 liner.

    @
    QNetworkRequest *request = new QNetworkRequest(QUrl("http://www.google.com"));
    @

    Error:
    Golfllink.obj:: error: unresolved external symbol "__declspec(dllimport) public: __thiscall QNetworkRequest::QNetworkRequest(class QUrl const &)" (_imp??0QNetworkRequest@@QAE@ABVQUrl@@@Z) referenced in function "public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __thiscall Golflink::getHtmlByUrl(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (?getHtmlByUrl@Golflink@@QAE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V23@@Z)

    [EDIT: code formatting, please use @-tags, Volker]

    1 Reply Last reply
    0
    • G Offline
      G Offline
      goetz
      wrote on last edited by
      #2

      You are missing QtNetwork library. Add

      @
      QT += network
      @

      to your .pro file and read about Qt way of "Declaring Qt Libraries":ttp://doc.qt.nokia.com/4.7/qmake-project-files.html#declaring-qt-libraries in qmake .pro files.

      "QNetworkRequest":http://doc.qt.nokia.com/4.7/qnetworkrequest.html states, like all other classes in the API reference docs, which module they are in. These modules have to be added to the QT variable in the .pro file.

      http://www.catb.org/~esr/faqs/smart-questions.html

      1 Reply Last reply
      1
      • U Offline
        U Offline
        uzi17
        wrote on last edited by
        #3

        that solved it

        thanks!

        1 Reply Last reply
        1

        • Login

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