gpt4 book ai didi

qt-creator - 调试时QtCreator的标准输出在哪里?

转载 作者:行者123 更新时间:2023-12-04 00:30:15 27 4
gpt4 key购买 nike

在使用 QtCreator(不是因为 Qt,而是因为它是一个不错的 IDE)和 CDB 调试 CMake(非 qt)项目时,我刚刚意识到以下几点。

该程序有一个简单的 cout 代码行,当我使用 Ctrl+R 运行该程序时,它会正确显示在“应用程序输出” Pane 中。但是,如果我使用 F5 调试相同的构建和运行配置,则看不到任何输出。
QtCreator 在第二种情况下将标准输出转发到哪里?

最佳答案

可以看到打印在调试日志上的输出,它是Window->Views->Debugger Log下的一个 Pane

右 Pane 显示了预期的输出。不是一个完整的解决方案,而是一个非常接近的解决方法。

我相信 qt creator 只能看到来自 cdb 的输出并且它不会转发程序的输出,而只会转发它自己的输出。事实上,应用程序输出 Pane 显示了一行与我在程序中进行的系统调用相关的 cdb 输出。

此解决方法会导致奇怪的副作用。当 cdb 遇到断点时,该 Pane 的颜色方案将重置为默认值。

在旁注中,有一份 closed bug 报告指出

There is a difference to the old debugging engine in that the printf()-output of console-applications is suppressed in debug/console-builds of Qt Creator builds. In previous versions, the output used to go to the terminal Qt Creator was started in.



在我的情况下不是这样,因为从 cmd 启动 qtcreator 与 cmd 分离。

关于qt-creator - 调试时QtCreator的标准输出在哪里?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29005357/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com