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

相关文章
|
数据库 数据库管理
【异常解决】svn报“Previous operation has not finished; run ‘cleanup‘ if it was interrupted”的错误解决方案
【异常解决】svn报“Previous operation has not finished; run ‘cleanup‘ if it was interrupted”的错误解决方案
518 0
|
7月前
An unexpected error was encountered while executing a WSL command. Common causes include access righ
An unexpected error was encountered while executing a WSL command. Common causes include access righ
|
7月前
|
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“.
1508 0
|
Android开发
意外导致了gradle project sync failed. Basic functionality will not work properly
意外导致了gradle project sync failed. Basic functionality will not work properly
意外导致了gradle project sync failed. Basic functionality will not work properly
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(完美解决)
423 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.
536 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“ 的解决方法
340 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“ 的解决办法
IDEA:cannot start process,the working directory ‘***‘ does not exist
IDEA:cannot start process,the working directory ‘***‘ does not exist
|
缓存 Android开发
【错误记录】Android Studio 编译报错 ( A problem occurred starting process ‘command ‘ninja.exe‘ ‘ )
【错误记录】Android Studio 编译报错 ( A problem occurred starting process ‘command ‘ninja.exe‘ ‘ )
1032 0
【错误记录】Android Studio 编译报错 ( A problem occurred starting process ‘command ‘ninja.exe‘ ‘ )