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 一个即可!

相关文章
|
2月前
|
网络协议 网络安全 数据库
|
4月前
Showing Recent Messages Command CodeSign failed with a nonzero exit code
Showing Recent Messages Command CodeSign failed with a nonzero exit code
51 0
|
10月前
|
缓存 JavaScript
Error: EPERM: operation not permitted, mkdir ‘C:\Program Files\nodejs‘TypeError: Cannot read proper
Error: EPERM: operation not permitted, mkdir ‘C:\Program Files\nodejs‘TypeError: Cannot read proper
110 0
|
11月前
|
数据库 数据库管理
【异常解决】svn报“Previous operation has not finished; run ‘cleanup‘ if it was interrupted”的错误解决方案
【异常解决】svn报“Previous operation has not finished; run ‘cleanup‘ if it was interrupted”的错误解决方案
361 0
|
4月前
|
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“.
1097 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(完美解决)
384 0
Error:svn:E155037:Previous operation has not finished; run ‘cleanup‘ if it was interrupted(完美解决)
|
计算机视觉
Qt 配置好OpenCV运行报错 The process was ended forcefully. exe Crashed.
Qt 配置好OpenCV运行报错 The process was ended forcefully. exe Crashed.
491 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“ 的解决方法
303 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“ 的解决办法
245 0
svn报错:“Previous operation has not finished; run ‘cleanup‘ if it was interrupted“ 的解决办法