Qt常见编译警告错误集锦

1、error: C2338: The slot requires more arguments than the signal provides.
原因:connect 信号和槽参数不匹配

2、…\opencv\build\include\opencv2\core\mat.hpp:1965:
warning: C4819: 该文件包含不能在当前代码页(936)中表示的字符。请将该文件保存为 Unicode 格式以防止数据丢失。
原因:编码冲突
解决方法:在包含opencv文件的最前面,添加代码 # pragma warning (disable:4819)

3、warning: no previous extern declaration for non-static variable ‘flag’
以前没有非静态变量flag的外部声明

原因:之前在定义一个全局变量的时候,直接在window.cpp中进行了int flag;的定义,之后在main.c中需要用这个变量的时候,直接加了extern int flag;,编译后产生上述警告。

解决方法:
如果只在一个文件中使用该全局变量:
在window.h中进行静态全局变量的定义static int flag;
如果需要在几个文件中同时使用该全局变量:
步骤1. 在window.h中定义extern int flag;
步骤2. 在main.c中添加头文件#include “window.h”,
步骤3. 在main.c中定义int flag;

原因和解决方案来源 : Qt:解决 warning: no previous extern declaration for non-static variable ‘XXX‘.
原作者:Gabriel.Tian的博客.

4、warning: ‘CameraInterface’ has virtual functions but non-virtual destructor
警告:“camerainterface”具有虚拟函数,但不是虚拟析构函数

  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值