no matching function for call to ‘QObject::connect(QCoreApplication*, const char [15], main(int, char**)::<lambda()>)’ });
时间: 2024-03-29 10:36:44 浏览: 135
这个错误通常是因为 `QObject::connect()` 函数的参数不匹配导致的。该函数的第一个参数是发送信号的对象,第二个参数是信号的名称,第三个参数是接收信号的对象,第四个参数是槽函数的名称。在此错误中,由于第三个参数是一个 lambda 表达式,所以编译器无法推断出正确的类型。
要解决此问题,可以将 lambda 表达式转换为指向接收信号的对象的槽函数的指针,或者使用 `std::function` 类型作为槽函数参数,这样就可以使用 lambda 表达式。另外,请确保信号和槽函数的参数类型匹配,并且信号和槽函数在同一个线程中执行。
相关问题
no matching function for call to widget::connect
This error message typically occurs in Qt when you try to connect a signal to a slot, but the arguments of the signal and the slot do not match. To fix it, you need to make sure that the arguments of the signal and the slot are compatible.
For example, if you have a signal that takes an integer parameter and a slot that takes a string parameter, you will get this error message. To fix it, you either need to change the signal to take a string parameter or change the slot to take an integer parameter.
Here's an example of how to connect a signal to a slot with compatible arguments:
```
QObject::connect(sender, &Sender::valueChanged, receiver, &Receiver::updateValue);
```
In this example, the signal "valueChanged" takes an integer parameter and the slot "updateValue" also takes an integer parameter, so they are compatible. If your code is still giving you the "no matching function for call to widget::connect" error message, double-check the arguments of the signal and the slot to make sure they match.
error: no matching function for call to ‘HikTest::testAbsoluteEx(char*&, char*&)’
这个错误提示表示在HikTest类中没有匹配的testAbsoluteEx函数,或者是函数参数类型不正确。你需要检查一下HikTest类的定义以及testAbsoluteEx函数的声明和实现,看看是否有定义或者参数类型不匹配的问题。此外,还需要检查一下你调用testAbsoluteEx函数时传入的参数类型是否和函数定义中的参数类型一致。
阅读全文