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);

再次编译,错误就没有了

相关文章
|
7月前
|
NoSQL 编译器 API
关于thread使用的错误:pure virtual method called terminate called without an active exception
关于thread使用的错误:pure virtual method called terminate called without an active exception
130 1
|
6月前
|
存储 缓存 自然语言处理
“error“: { “root_cause“: [{ “type“: “circuit_breaking_exception“, “reason“: “[parent] D【已解决】
“error“: { “root_cause“: [{ “type“: “circuit_breaking_exception“, “reason“: “[parent] D【已解决】
49 1
|
6月前
|
Java
【ERROR】‘<>‘ operator is not allowed for source level below 1.7
【ERROR】‘<>‘ operator is not allowed for source level below 1.7
57 0
|
7月前
|
JavaScript 安全 网络安全
Node: opensslErrorStack: [ ‘error:03000086:digital envelope routines::initialization error‘ ]异常处理
Node: opensslErrorStack: [ ‘error:03000086:digital envelope routines::initialization error‘ ]异常处理
2998 0
|
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
|
数据安全/隐私保护
Do Sync Disk 0 Part 0 Failed, code=S3_F42, msg=Sync Failed after retry 5 times
Do Sync Disk 0 Part 0 Failed, code=S3_F42, msg=Sync Failed after retry 5 times
191 1
|
关系型数据库 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
181 0
|
Java Android开发
Bad method handle type 7异常解决
在利用androidx版本写demo时,在添加了一些依赖后,遇到了`java.lang.ClassNotFoundException`bug,这就很奇怪了,我就添加rxjava3的依赖,就给我报这个错误。
|
网络安全 Windows
解决adb报错“failed to create fdevent interrupt socketpair: Invalid argument“问题
解决adb报错“failed to create fdevent interrupt socketpair: Invalid argument“问题
347 0
解决adb报错“failed to create fdevent interrupt socketpair: Invalid argument“问题