Название: ошибка: no matching member function for call to 'connect' Отправлено: Noize_programmer от Февраль 03, 2023, 12:50 Решено Решено Решено Решено Решено Решено Решено Решено Решено Решено Решено Решено Решено Код: connect(& pClientSoket,SIGNAL(pClientSoket::disconnected),& pClientSoket,SLOT(pClientSoket::deleteLater)); помогите пожалуйста ( пробовал исправить по разному: https://www.cyberforum.ru/qt/thread2248341.html (https://www.cyberforum.ru/qt/thread2248341.html) https://stackoverflow.com/questions/24410130/no-matching-function-for-qobjectconnect (https://stackoverflow.com/questions/24410130/no-matching-function-for-qobjectconnect) https://forum.qt.io/topic/86414/error-no-matching-function-for-call-to-qobject-connect (https://forum.qt.io/topic/86414/error-no-matching-function-for-call-to-qobject-connect) ) Название: Re: ошибка: no matching member function for call to 'connect' Отправлено: kambala от Февраль 03, 2023, 13:59 надо писать либо
Код либо Код
Название: Re: ошибка: no matching member function for call to 'connect' Отправлено: Noize_programmer от Февраль 05, 2023, 15:33 если пишу это
Код: connect(&pClientSoket, SIGNAL(disconnected()), &pClientSoket, SLOT(deleteLater())); ошибка: no matching member function for call to 'connect' а если пишу это Код: connect(&pClientSoket, &QTcpSocket::disconnected, &pClientSoket, &QTcpSocket::deleteLater); ошибка: no matching member function for call to 'connect' Название: Re: ошибка: no matching member function for call to 'connect' Отправлено: kambala от Февраль 05, 2023, 16:13 полная ошибка всегда пишется во вкладке номер 4, без нее ничего не понятно
Название: Re: ошибка: no matching member function for call to 'connect' Отправлено: Noize_programmer от Февраль 06, 2023, 14:53 полная ошибка всегда пишется во вкладке номер 4, без нее ничего не понятно вот:14:32:15: Выполняются этапы для проекта TCP_server... 14:32:15: Настройки не изменились, этап qmake пропускается. 14:32:15: Запускается: «F:\Qt5.14\Tools\mingw730_64\bin\mingw32-make.exe» -j6 F:/Qt5.14/Tools/mingw730_64/bin/mingw32-make -f Makefile.Debug mingw32-make[1]: Entering directory 'F:/Qt_project/5.0.2/lesons/Book/TCP_server/build-TCP_server-Desktop_Qt_5_12_12_MinGW_64_bit-Debug' g++ -c -fno-keep-inline-dllexport -g -std=gnu++11 -Wall -W -Wextra -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -I..\TCP_server -I. -IF:\Qt5.14\5.12.12\mingw73_64\include -IF:\Qt5.14\5.12.12\mingw73_64\include\QtWidgets -IF:\Qt5.14\5.12.12\mingw73_64\include\QtGui -IF:\Qt5.14\5.12.12\mingw73_64\include\QtANGLE -IF:\Qt5.14\5.12.12\mingw73_64\include\QtNetwork -IF:\Qt5.14\5.12.12\mingw73_64\include\QtCore -Idebug -I/include -IF:\Qt5.14\5.12.12\mingw73_64\mkspecs\win32-g++ -o debug\myserver.o ..\TCP_server\myserver.cpp ..\TCP_server\myserver.cpp: In member function 'virtual void MyServer::SNewConnection()': ..\TCP_server\myserver.cpp:48:94: error: no matching function for call to 'MyServer::connect(QTcpSocket**, void (QAbstractSocket::*)(), QTcpSocket**, void (QObject::*)())' connect(&pClientSoket, &QTcpSocket::disconnected, &pClientSoket, &QTcpSocket::deleteLater); ^ In file included from F:\Qt5.14\5.12.12\mingw73_64\include/QtWidgets/qwidget.h:45:0, from F:\Qt5.14\5.12.12\mingw73_64\include\QtWidgets/qmainwindow.h:44, from F:\Qt5.14\5.12.12\mingw73_64\include\QtWidgets/QMainWindow:1, from ..\TCP_server\myserver.h:4, from ..\TCP_server\myserver.cpp:1: F:\Qt5.14\5.12.12\mingw73_64\include/QtCore/qobject.h:208:36: note: candidate: static QMetaObject::Connection QObject::connect(const QObject*, const char*, const QObject*, const char*, Qt::ConnectionType) static QMetaObject::Connection connect(const QObject *sender, const char *signal, ^~~~~~~ F:\Qt5.14\5.12.12\mingw73_64\include/QtCore/qobject.h:208:36: note: no known conversion for argument 1 from 'QTcpSocket**' to 'const QObject*' F:\Qt5.14\5.12.12\mingw73_64\include/QtCore/qobject.h:[/color]211:36: note: candidate: static QMetaObject::Connection QObject::connect(const QObject*, const QMetaMethod&, const QObject*, const QMetaMethod&, Qt::ConnectionType) static QMetaObject::Connection connect(const QObject *sender, const QMetaMethod &signal, ^~~~~~~ F:\Qt5.14\5.12.12\mingw73_64\include/QtCore/qobject.h:211:36: note: no known conversion for argument 1 from 'QTcpSocket**' to 'const QObject*' F:\Qt5.14\5.12.12\mingw73_64\include/QtCore/qobject.h:463:32: note: candidate: QMetaObject::Connection QObject::connect(const QObject*, const char*, const char*, Qt::ConnectionType) const inline QMetaObject::Connection QObject::connect(const QObject *asender, const char *asignal, ^~~~~~~ F:\Qt5.14\5.12.12\mingw73_64\include/QtCore/qobject.h:463:32: note: no known conversion for argument 1 from 'QTcpSocket**' to 'const QObject*' F:\Qt5.14\5.12.12\mingw73_64\include/QtCore/qobject.h:228:43: note: candidate: static QMetaObject::Connection QObject::connect(const typename QtPrivate::FunctionPointer<Func>::Object*, Func1, const typename QtPrivate::FunctionPointer<Func2>::Object*, Func2, Qt::ConnectionType) [with Func1 = void (QAbstractSocket::*)(); Func2 = void (QObject::*)(); typename QtPrivate::FunctionPointer<Func>::Object = QAbstractSocket; typename QtPrivate::FunctionPointer<Func2>::Object = QObject] static inline QMetaObject::Connection connect(const typename QtPrivate::FunctionPointer<Func1>::Object *sender, Func1 signal, ^~~~~~~ F:\Qt5.14\5.12.12\mingw73_64\include/QtCore/qobject.h:228:43: note: no known conversion for argument 1 from 'QTcpSocket**' to 'const Object* {aka const QAbstractSocket*}' F:\Qt5.14\5.12.12\mingw73_64\include/QtCore/qobject.h:260:13: note: candidate: template<class Func1, class Func2> static typename std::enable_if<((int)(QtPrivate::FunctionPointer<Func2>::ArgumentCount) >= 0), QMetaObject::Connection>::type QObject::connect(const typename QtPrivate::FunctionPointer<Func>::Object*, Func1, Func2) connect(const typename QtPrivate::FunctionPointer<Func1>::Object *sender, Func1 signal, Func2 slot) ^~~~~~~ F:\Qt5.14\5.12.12\mingw73_64\include/QtCore/qobject.h:260:13: note: template argument deduction/substitution failed: ..\TCP_server\myserver.cpp:48:94: note: candidate expects 3 arguments, 4 provided connect(&pClientSoket, &QTcpSocket::disconnected, &pClientSoket, &QTcpSocket::deleteLater); ^ In file included from F:\Qt5.14\5.12.12\mingw73_64\include/QtWidgets/qwidget.h:45:0, from F:\Qt5.14\5.12.12\mingw73_64\include\QtWidgets/qmainwindow.h:44, from F:\Qt5.14\5.12.12\mingw73_64\include\QtWidgets/QMainWindow:1, from ..\TCP_server\myserver.h:4, from ..\TCP_server\myserver.cpp:1: F:\Qt5.14\5.12.12\mingw73_64\include/QtCore/qobject.h:269:13: note: candidate: template<class Func1, class Func2> static typename std::enable_if<(((int)(QtPrivate::FunctionPointer<Func2>::ArgumentCount) >= 0) && (! QtPrivate::FunctionPointer<Func2>::IsPointerToMemberFunction)), QMetaObject::Connection>::type QObject::connect(const typename QtPrivate::FunctionPointer<Func>::Object*, Func1, const QObject*, Func2, Qt::ConnectionType) connect(const typename QtPrivate::FunctionPointer<Func1>::Object *sender, Func1 signal, const QObject *context, Func2 slot, ^~~~~~~ F:\Qt5.14\5.12.12\mingw73_64\include/QtCore/qobject.h:269:13: note: template argument deduction/substitution failed: ..\TCP_server\myserver.cpp:48:55: note: cannot convert '& pClientSoket' (type 'QTcpSocket**') to type 'const QObject*' connect(&pClientSoket, &QTcpSocket::disconnected, &pClientSoket, &QTcpSocket::deleteLater); ^~~~~~~~~~~~~ In file included from F:\Qt5.14\5.12.12\mingw73_64\include/QtWidgets/qwidget.h:45:0, from F:\Qt5.14\5.12.12\mingw73_64\include\QtWidgets/qmainwindow.h:44, from F:\Qt5.14\5.12.12\mingw73_64\include\QtWidgets/QMainWindow:1, from ..\TCP_server\myserver.h:4, from ..\TCP_server\myserver.cpp:1: F:\Qt5.14\5.12.12\mingw73_64\include/QtCore/qobject.h:300:13: note: candidate: template<class Func1, class Func2> static typename std::enable_if<(QtPrivate::FunctionPointer<Func2>::ArgumentCount == -1), QMetaObject::Connection>::type QObject::connect(const typename QtPrivate::FunctionPointer<Func>::Object*, Func1, Func2) connect(const typename QtPrivate::FunctionPointer<Func1>::Object *sender, Func1 signal, Func2 slot) ^~~~~~~ F:\Qt5.14\5.12.12\mingw73_64\include/QtCore/qobject.h:300:13: note: template argument deduction/substitution failed: ..\TCP_server\myserver.cpp:48:94: note: candidate expects 3 arguments, 4 provided connect(&pClientSoket, &QTcpSocket::disconnected, &pClientSoket, &QTcpSocket::deleteLater); ^ In file included from F:\Qt5.14\5.12.12\mingw73_64\include/QtWidgets/qwidget.h:45:0, from F:\Qt5.14\5.12.12\mingw73_64\include\QtWidgets/qmainwindow.h:44, from F:\Qt5.14\5.12.12\mingw73_64\include\QtWidgets/QMainWindow:1, from ..\TCP_server\myserver.h:4, from ..\TCP_server\myserver.cpp:1: F:\Qt5.14\5.12.12\mingw73_64\include/QtCore/qobject.h:308:13: note: candidate: template<class Func1, class Func2> static typename std::enable_if<(QtPrivate::FunctionPointer<Func2>::ArgumentCount == -1), QMetaObject::Connection>::type QObject::connect(const typename QtPrivate::FunctionPointer<Func>::Object*, Func1, const QObject*, Func2, Qt::ConnectionType) connect(const typename QtPrivate::FunctionPointer<Func1>::Object *sender, Func1 signal, const QObject *context, Func2 slot, ^~~~~~~ F:\Qt5.14\5.12.12\mingw73_64\include/QtCore/qobject.h:308:13: note: template argument deduction/substitution failed: ..\TCP_server\myserver.cpp:48:55: note: cannot convert '& pClientSoket' (type 'QTcpSocket**') to type 'const QObject*' connect(&pClientSoket, &QTcpSocket::disconnected, &pClientSoket, &QTcpSocket::deleteLater); ^~~~~~~~~~~~~ ..\TCP_server\myserver.cpp: In member function 'void MyServer::SReadClient()': ..\TCP_server\myserver.cpp:67:47: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] if(pClientSoket->bytesAvailable() < sizeof (quint16)) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~ mingw32-make[1]: *** [Makefile.Debug:487: debug/myserver.o] Error 1 mingw32-make[1]: Leaving directory 'F:/Qt_project/5.0.2/lesons/Book/TCP_server/build-TCP_server-Desktop_Qt_5_12_12_MinGW_64_bit-Debug' mingw32-make: *** [Makefile:38: debug] Error 2 14:32:18: Процесс «F:\Qt5.14\Tools\mingw730_64\bin\mingw32-make.exe» завершился с кодом 2. Ошибка при сборке/развёртывании проекта TCP_server (комплект: Desktop Qt 5.12.12 MinGW 64-bit) Во время выполнения этапа «Сборка» 14:32:18: Прошло времени: 00:03. Название: Re: ошибка: no matching member function for call to 'connect' Отправлено: kambala от Февраль 06, 2023, 15:03 а, так pClientSoket у тебя уже и так указатель, тогда не надо перед ним ставить &
вот почему надо сразу давать максимальную информацию о коде Название: Re: ошибка: no matching member function for call to 'connect' Отправлено: Noize_programmer от Февраль 06, 2023, 15:06 а, так pClientSoket у тебя уже и так указатель, тогда не надо перед ним ставить & вот почему надо сразу давать максимальную информацию о коде огромное сапсибо за помощь! p.s. впредь буду давать больше информации о коде (я пошёл писать TCP Client) |