Results 1 to 4 of 4

Thread: no matching function for call to 'qHash(const PB::phonebook&)' error

  1. #1
    Join Date
    May 2016
    Posts
    10
    Thanks
    2
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Windows

    Default no matching function for call to 'qHash(const PB::phonebook&)' error

    C:\Qt\Qt5.10.0\5.10.0\mingw53_32\include\QtCore\qh ashfunctions.h:112: error: no matching function for call to 'qHash(const PB:honebook&)'
    Q_DECL_NOEXCEPT_EXPR(noexcept(qHash(t)))
    ^


    can someone please assist me with solution to the above error I have attached files of my project
    Attached Files Attached Files

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: no matching function for call to 'qHash(const PB::phonebook&)' error

    From the docs:

    For a key type K, the qHash function must have one of these signatures:

    uint qHash(K key);
    uint qHash(const K &key);

    uint qHash(K key, uint seed);
    uint qHash(const K &key, uint seed);
    Your qHash() function does not match any of these signatures. Read the compiler's error message and compare it to what your code says.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  3. The following user says thank you to d_stranz for this useful post:

    gotronics (14th January 2018)

  4. #3
    Join Date
    May 2016
    Posts
    10
    Thanks
    2
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Windows

    Default Re: no matching function for call to 'qHash(const PB::phonebook&)' error

    thanks I have done that before and did not work except when I put everything in main function the code works well except when I put in header and source file, so no solution yet please assist again

  5. #4
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: no matching function for call to 'qHash(const PB::phonebook&)' error

    Did you not read my last reply?

    Your code declares a function
    Qt Code:
    1. uint qHash( PB::phonebook & )
    To copy to clipboard, switch view to plain text mode 
    Does that match any of the signatures described in the QHash documentation I posted? If you think it does, then you need to study your C++ books again. If you can't find a match, how could you change your function so it does match one of the signatures? Once you make that change, then that part of your code should compile without error.

    I am not going to write your code for you - you need to understand this on your own.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

Similar Threads

  1. Replies: 5
    Last Post: 5th December 2013, 05:37
  2. Replies: 2
    Last Post: 10th June 2012, 13:48
  3. error: no matching function for call to ‘QTimer:
    By saman_artorious in forum Qt Programming
    Replies: 2
    Last Post: 21st May 2012, 16:27
  4. about no matching function for call to
    By Alain Delon in forum General Programming
    Replies: 1
    Last Post: 5th March 2011, 22:30
  5. Replies: 1
    Last Post: 1st December 2010, 12:02

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.