Error in inclusion of <QNetworkAccessManager>,<QNetworkReply> in cpp file of a BB10 app development

Sunil Targe picture Sunil Targe · Aug 16, 2013 · Viewed 8.4k times · Source

I am currently working on BB10 app development and trying for some HTTP connection demo app.

But in the cpp file is giving a ? in front of inclusion statement #include <QNetworkAccessManager> saying Unresolved Inclusion : <QNetworkAccessManager>.

Anyone please help me.

Thanks in advance.

Answer

Marc Plano-Lesay picture Marc Plano-Lesay · Aug 17, 2013

QNetworkAccessManager comes with the QtNetwork module. You could do this: #include <QtNetwork/QNetworkAccessManager>, which should compile. However, it will not link, you need to link to QtNetwork. To achieve this, you should tell QMake that you're using QtNetwork. Add this to your .pro project file: QT += network.

This has two effects: first, the compiler will look for include files in the QtNetwork subdirectory too (so you don't need to include <QtNetwork/QNetworkAccessManager>, <QNetworkAccessManager> will work just fine). Secondly, the linker will link to QtNetwork too. So everything will work just fine.

You can read more about using Qt modules here.