The program has unexpectedly finished.解决方法

简介: 一般出现上述错误是因为控件没有进行实例化,错误案例如下:

一般出现上述错误是因为控件没有进行实例化,错误案例如下:

widget.h文件中:

...  
private:
    QLabel *label;
...

widget.cpp 文件中:

...
label->setText(tr("dsadsa"));
...
上述在cpp文件中, label 没有进行实例化,从而导致程序报错,解决方法在 widget.cpp文件中对 label 进行实例化即可;

widget.cpp 文件如下:

...
label = new QLabel(this);
label->setText(tr("dsadsa"));
...

new 一个即可!

相关文章
|
4月前
|
网络协议 网络安全 数据库
|
6月前
Showing Recent Messages Command CodeSign failed with a nonzero exit code
Showing Recent Messages Command CodeSign failed with a nonzero exit code
66 0
|
数据库 数据库管理
【异常解决】svn报“Previous operation has not finished; run ‘cleanup‘ if it was interrupted”的错误解决方案
【异常解决】svn报“Previous operation has not finished; run ‘cleanup‘ if it was interrupted”的错误解决方案
476 0
|
6月前
|
NoSQL C语言
vscode出现 ERROR: Unable to start debugging. Unexpected GDB output from command “-exec-run“.
vscode出现 ERROR: Unable to start debugging. Unexpected GDB output from command “-exec-run“.
1445 0
Error:svn:E155037:Previous operation has not finished; run ‘cleanup‘ if it was interrupted(完美解决)
Error:svn:E155037:Previous operation has not finished; run ‘cleanup‘ if it was interrupted(完美解决)
416 0
Error:svn:E155037:Previous operation has not finished; run ‘cleanup‘ if it was interrupted(完美解决)
|
Ubuntu
解决办法:GLib-ERROR **: Creating pipes for GWakeup: Too many open files
解决办法:GLib-ERROR **: Creating pipes for GWakeup: Too many open files
172 0
|
计算机视觉
Qt 配置好OpenCV运行报错 The process was ended forcefully. exe Crashed.
Qt 配置好OpenCV运行报错 The process was ended forcefully. exe Crashed.
529 0
Qt 配置好OpenCV运行报错 The process was ended forcefully. exe Crashed.
TortoiseSVN报错:“Previous operation has not finished; run 'clean up' if it was interrupted“ 的解决方法
TortoiseSVN报错:“Previous operation has not finished; run 'clean up' if it was interrupted“ 的解决方法
336 0
TortoiseSVN报错:“Previous operation has not finished; run 'clean up' if it was interrupted“ 的解决方法
svn报错:“Previous operation has not finished; run ‘cleanup‘ if it was interrupted“ 的解决办法
svn报错:“Previous operation has not finished; run ‘cleanup‘ if it was interrupted“ 的解决办法
252 0
svn报错:“Previous operation has not finished; run ‘cleanup‘ if it was interrupted“ 的解决办法