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