Qt qDebug() doesn't work in Windows shell

青春壹個敷衍的年華 提交于 2019-12-12 11:05:27

问题


I am using a qDebug() of Qt Framework for printf something on the screen. It works just fine when I run application from Qt Creator, but when I try to execute it from Windows cmd it shows nothing. Why that happens?


回答1:


You have to add

CONFIG += console

to your projects .pro file and do not forget to clean and build (rebuild) your project.




回答2:


Run your application with

application.exe > log.txt 2>&1

It redirects stderr to stdout and stdout to a file.



来源:https://stackoverflow.com/questions/13431734/qt-qdebug-doesnt-work-in-windows-shell

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!