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. [solved] Http example from Qt giving strange error! n00b question!
QtWS25 Last Chance

[solved] Http example from Qt giving strange error! n00b question!

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 2.4k 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.
  • P Offline
    P Offline
    peeterparker
    wrote on last edited by
    #1

    Hi,

    I am very new to C++ and therefore Qt, I tried the "HTTP example":http://doc.trolltech.com/4.2/network-http.html present on this website. I had the headers and the cpp files in the correct folder but I get a strange error

    :-1: error: symbol(s) not found
    :-1: error: collect2: ld returned 1 exit status

    and after I expand these, I get the following output

    Undefined symbols:
    make: Leaving directory `/Users/pfn368/CS340/HttpWindow-build-desktop-Desktop_Qt_4_7_4_for_GCC__Qt_SDK__Debug'
    "QHttp::setUser(QString const&, QString const&)", referenced from:
    HttpWindow::downloadFile() in httpwindow.o
    "QHttp::abort()", referenced from:
    HttpWindow::readResponseHeader(QHttpResponseHeader const&) in httpwindow.o
    HttpWindow::cancelDownload() in httpwindow.o
    "QHttp::get(QString const&, QIODevice*)", referenced from:
    HttpWindow::downloadFile() in httpwindow.o
    "QHttp::QHttp(QObject*)", referenced from:
    HttpWindow::HttpWindow(QWidget*)in httpwindow.o
    HttpWindow::HttpWindow(QWidget*)in httpwindow.o
    "QHttp::errorString() const", referenced from:
    HttpWindow::httpRequestFinished(int, bool)in httpwindow.o
    "QHttp::setHost(QString const&, unsigned short)", referenced from:
    HttpWindow::downloadFile() in httpwindow.o
    "QHttpResponseHeader::statusCode() const", referenced from:
    HttpWindow::readResponseHeader(QHttpResponseHeader const&) in httpwindow.o
    "QHttpResponseHeader::reasonPhrase() const", referenced from:
    HttpWindow::readResponseHeader(QHttpResponseHeader const&) in httpwindow.o
    ld: symbol(s) not found
    collect2: ld returned 1 exit status
    make: *** [HttpWindow.app/Contents/MacOS/HttpWindow] Error 1
    The process "/usr/bin/make" exited with code 2.
    Error while building project HttpWindow (target: Desktop)
    When executing build step 'Make'

    Also to add to the question, the #include was mentioned as #include<QtNetwork> in the example but if I have that in my code it shouts "QtNetwork: No such file or directory" hence I included everything under @"#include <QtNetwork/QHttp>"@, "#include <QtNetwork/QHttpResponseHeader>", "#include <QtNetwork/QHttpRequestHeader>", "#include <QtNetwork/QHttpHeader>", "#include <QtNetwork/qhttp.h>"

    1 Reply Last reply
    0
    • P Offline
      P Offline
      peeterparker
      wrote on last edited by
      #2

      Oh shuut!

      I forgot to add the line
      QT += network
      to my project file hence this error was cropping up. Now everyhting seems to be running fine, except that I don't see any file that was downloaded.

      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