Qt qDebug() doesn't work in Windows shell
Asked Answered
G

2

7

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?

Gallaway answered 17/11, 2012 at 14:56 Comment(1)
This has been asked several times in the past. I do not have more close votes for today, but if someone has, please see it as the duplicate of #3361048Neckerchief
S
11

You have to add

CONFIG += console

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

Shifrah answered 17/11, 2012 at 15:55 Comment(2)
Thanks. It works. I think I even tried this before, but didn't clean and build full project.Gallaway
I've add recommendation to clean and build to answer.Shifrah
S
3

Run your application with

application.exe > log.txt 2>&1

It redirects stderr to stdout and stdout to a file.

Sonometer answered 20/5, 2014 at 8:53 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.