Results 1 to 3 of 3

Thread: QNetworkAccessManager->get problem (no matching function)

  1. #1
    Join Date
    Mar 2011
    Posts
    34
    Qt products
    Qt4
    Platforms
    Windows

    Default QNetworkAccessManager->get problem (no matching function)

    I've checked lots of examples and this code is supposed connect to google.com
    Qt Code:
    1. QNetworkAccessManager * Network_Manager;
    2. Network_Manager = new QNetworkAccessManager(this);
    3. QString URL;
    4. URL = "http://www.google.com/";
    5. QNetworkRequest netRequest(QUrl(URL));
    6. Network_Manager->get(netRequest);
    To copy to clipboard, switch view to plain text mode 
    But I get this error when trying to compile:
    Qt Code:
    1. error: no matching function for call to QNetworkAccessManager::get(QNetworkRequest (&)(QUrl))'
    2. candidates are: QNetworkReply* QNetworkAccessManager::get(const QNetworkRequest&)
    To copy to clipboard, switch view to plain text mode 
    I've added
    #include <QNetworkAccessManager>
    #include <QtNetwork>
    and
    QT += network in my .pro

    thanks in advance...

  2. #2
    Join Date
    Mar 2011
    Posts
    34
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QNetworkAccessManager->get problem (no matching function)

    No one?
    Could this be a bug??
    I've tried it with version 4.7.3 and 4.8.0 beta...

  3. #3
    Join Date
    Sep 2019
    Posts
    1
    Qt products
    Qt5
    Platforms
    Unix/X11

    Smile Re: QNetworkAccessManager->get problem (no matching function)

    I just got the same error. It is not bug but c++ syntax. Compilator thinks that QNetworkRequest netRequest(QUrl(URL)); is a function declaration. Yes we can make a declaration in another function. In the error you get
    QNetworkRequest (&)(QUrl) - is a function type. But its still weird why we can declare function argument with its initialization?? QUrl uri in param-list its clear, but i dunno what could QUrl(uri) mean.

    You need to replace your line 5 with QNetworkRequest netRequest = QNetworkRequest(QUrl(URL));

    sry for late response, mb someone else gets stuck in that.

Similar Threads

  1. Replies: 1
    Last Post: 19th March 2011, 11:57
  2. about no matching function for call to
    By Alain Delon in forum General Programming
    Replies: 1
    Last Post: 5th March 2011, 22:30
  3. no matching function for call to setupUi
    By ctote in forum Qt Programming
    Replies: 2
    Last Post: 30th January 2010, 16:20
  4. no matching function error
    By arpspatel in forum Qt Programming
    Replies: 4
    Last Post: 16th October 2009, 16:47
  5. No Matching function to call...
    By weepdoo in forum Qt Programming
    Replies: 2
    Last Post: 7th November 2008, 18:30

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.