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

相关文章
|
20天前
|
网络协议 网络安全 数据库
|
10月前
|
数据库 数据库管理
【异常解决】svn报“Previous operation has not finished; run ‘cleanup‘ if it was interrupted”的错误解决方案
【异常解决】svn报“Previous operation has not finished; run ‘cleanup‘ if it was interrupted”的错误解决方案
297 0
|
3月前
|
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“.
915 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(完美解决)
361 0
Error:svn:E155037:Previous operation has not finished; run ‘cleanup‘ if it was interrupted(完美解决)
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“ 的解决方法
291 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“ 的解决办法
241 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‘ ‘ )
964 0
【错误记录】Android Studio 编译报错 ( A problem occurred starting process ‘command ‘ninja.exe‘ ‘ )