error: static assertion failed: Signal and slot arguments are not compatible.

简介: error: static assertion failed: Signal and slot arguments are not compatible.

编译错误

/usr/include/x86_64-linux-gnu/qt5/QtCore/qobject.h:314: error: static assertion failed: Signal and slot arguments are not compatible.
  314 |         Q_STATIC_ASSERT_X((FunctorArgumentCount >= 0),
      |         ^~~~~~~~~~~~~~~~~
/usr/include/x86_64-linux-gnu/qt5/QtCore/qobjectdefs_impl.h:367: error: request for member ‘operator()’ in ‘QtPrivate::FunctorReturnType<const char*, QtPrivate::List<> >::dummy<const char*>()’, which is of non-class type ‘const char*’
  367 |         typedef decltype(dummy<Functor>().operator()((dummy<ArgList>())...)) Value;
      |                          ~~~~~~~~~~~~~~~~~~~~~~~~~~^

1.png


错误原因:


信号和插槽参数不兼容。


通俗的说,就是信号用的一种形式(如&QTimer::),槽用了另一种形式连接(SLOT)。


修改前:

connect(&timer,&QTimer::timeout,this,SLOT(timeout()));

修改后:

connect(&timer,&QTimer::timeout,this,&Http::timeout);

再次编译,错误就没有了

相关文章
|
6月前
|
编解码 数据处理
|
2月前
|
Go
panic:runtime error:invalid memory address or nil pointer dereference
panic:runtime error:invalid memory address or nil pointer dereference
|
5月前
|
存储 缓存 自然语言处理
“error“: { “root_cause“: [{ “type“: “circuit_breaking_exception“, “reason“: “[parent] D【已解决】
“error“: { “root_cause“: [{ “type“: “circuit_breaking_exception“, “reason“: “[parent] D【已解决】
44 1
|
Java Maven Android开发
成功解决FATAL ERROR in native method: JDWP on getting class status, jvmtiError=JVMTI_ERROR_WRONG_PHASE
成功解决FATAL ERROR in native method: JDWP on getting class status, jvmtiError=JVMTI_ERROR_WRONG_PHASE
|
6月前
|
Perl
报错:error Parsing error: x-invalid-end-tag
报错:error Parsing error: x-invalid-end-tag
131 0
|
关系型数据库 MySQL C++
Error:error C2601: ‘b‘ : local function definitions are illegal error C2063: ‘b‘ : not a function
Error:error C2601: ‘b‘ : local function definitions are illegal error C2063: ‘b‘ : not a function
175 0
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179)
353 0
|
Java Android开发
Bad method handle type 7异常解决
在利用androidx版本写demo时,在添加了一些依赖后,遇到了`java.lang.ClassNotFoundException`bug,这就很奇怪了,我就添加rxjava3的依赖,就给我报这个错误。