PDA

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



gotronics
13th January 2018, 18:59
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::phonebook&)'
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

d_stranz
14th January 2018, 01:28
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.

gotronics
14th January 2018, 19:56
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

d_stranz
14th January 2018, 20:04
Did you not read my last reply?

Your code declares a function
uint qHash( PB::phonebook & ) 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.