[Interest] QNetworkAccessManager errors

Olivier Austina olivier.austina at gmail.com
Sat Jun 22 15:38:25 CEST 2013


Hi,

I try to run this example from the Qt doc using Window XP Qt 4.8.4 in
console mode:
#include <QCoreApplication>

#include <QDebug>

#include <QtCore>

#include <QtNetwork/QNetworkAccessManager>



int main(int argc, char *argv[])

{

    QCoreApplication a(argc, argv);

    QNetworkAccessManager *manager = new QNetworkAccessManager(this);

    connect(manager, SIGNAL(proxyAuthenticationRequired(const
QNetworkProxy &, QAuthenticator *)),

      SLOT(slotProxyAuthenticationRequired(const QNetworkProxy &,
QAuthenticator *)));

      connect(manager, SIGNAL(authenticationRequired(QNetworkReply *,
QAuthenticator *)),

      SLOT(slotAuthenticationRequired(QNetworkReply *, QAuthenticator *)));

        return a.exec();

}

I got the following errors:
/Network/main.cpp:10:64: error: invalid use of 'this' in non-member function

../Network/main.cpp:12:85: error: 'connect' was not declared in this scope



This is the error output:

15:30:39: Exécution des étapes pour le projet Network...

15:30:39: Configuration inchangée, étape qmake sautée.

15:30:39: Débute : "C:\MinGW\bin\mingw32-make.exe"

C:/MinGW/bin/mingw32-make -f Makefile.Debug

mingw32-make[1]: Entering directory
`E:/C++/Qtproject/build-Network-Desktop-Debug'

g++ -c -pipe -g -frtti -fexceptions -mthreads -Wall -Wextra -DUNICODE
-DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_XML_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB
-DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2
-DQT_THREAD_SUPPORT -I'c:/Qt/4.8.4/include/QtCore'
-I'c:/Qt/4.8.4/include/QtNetwork' -I'c:/Qt/4.8.4/include/QtXml'
-I'c:/Qt/4.8.4/include' -I'c:/Qt/4.8.4/include/QtNetwork'
-I'c:/Qt/4.8.4/include/ActiveQt' -I'debug' -I'../Network' -I'.'
-I'c:/Qt/4.8.4/mkspecs/win32-g++' -o debug/main.o ../Network/main.cpp

../Network/main.cpp: In function 'int main(int, char**)':

../Network/main.cpp:10:64: error: invalid use of 'this' in non-member
function

../Network/main.cpp:12:85: error: 'connect' was not declared in this scope

mingw32-make[1]: Leaving directory
`E:/C++/Qtproject/build-Network-Desktop-Debug'

mingw32-make[1]: *** [debug/main.o] Error 1

mingw32-make: *** [debug] Error 2

15:30:45: Le processus "C:\MinGW\bin\mingw32-make.exe" s'est terminé avec
le code 2.

Erreur lors de la compilation/déploiement du projet Network (kit : Desktop)

Lors de l'exécution de l'étape "Make"

15:30:45: Elapsed time: 00:06.


Thanks.

Regards
Olivier
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20130622/90c889a1/attachment.html>


More information about the Interest mailing list