Qt的呼叫在释放模式失败 [英] Qt Call fails in Release Mode

查看:148
本文介绍了Qt的呼叫在释放模式失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经开发使用Qt,VS2013和加速的应用程序。它运行在调试模式下的罚款。但未能在释放模式下运行。这里是一片code的运行精细调试时,但在释放模式抛出异常:

I've developed an application using Qt, VS2013 and Boost. It runs fine in Debug mode. But fails to run in Release mode. Here's a piece of code that runs fine while debugging but throws an exception in release mode:

std::string str = ui.labels->toPlainText().toStdString();

而另一方面该调用正常工作:

This call on the other hand works fine:

QString str = ui.labels->toPlainText();

这有什么错code的那些行?其他提升通话正常工作。
谢谢。

Is there anything wrong with those lines of code? Other boost calls work fine. Thanks.

推荐答案

您很可能在尝试一次做太多的事情,这使得它很难确定它失败。尝试一步一步:

You're probably trying to do too many things at once, and that makes it hard to pinpoint where it fails. Try it step-by-step:

QString const text = ui.labels->toPlainText();
QByteArray const utf8 = text.toUtf8();
auto const str = utf8.toStdString();

这篇关于Qt的呼叫在释放模式失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆