EDIT: I have now posted my own answer, as per some suggestions below. It's not fantastic, so if anyone has suggestions for improvement, please let me know.
Let me never again underestimate the power of meta. Between downvotes to the accepted answer and upvotes to the next-highest-rated one, the top two answers are now tied for point-value.
The voting system, and the answer-accepting system, do a pretty good job of ensuring that the best answer to a question is usually the first one.
But, rarely, the accepted and top-voted answer is incorrect; more frequently, it is fatally incomplete.
For example, in this answer, there is no indication that (for a console app) all of the answers print to stderr
, and one of them can be removed at compile time. This is important information, especially given that OP appears to be looking for something analogous to std::cout
. Yes, it could probably be guessed by the names of the function-calls, but that's hardly a good reason not to make it explicit.
I have discussed these issues in the comments of the answer, including asking for the answerer to edit the question to at least incorporate the necessary information, but the answerer stopped responding two weeks ago.
The answer has been accepted and has more than twice as many votes of the next-highest-voted answer. I take this as an indication that many people are probably searching for an easy way to print to the console, seeing that the accepted answer mostly-works, and upvoting, probably without even realizing how incomplete the information is. At least it's not dangerous....unless someone tries to print an important run-time message using qDebug()
(unlikely given its name but certainly not impossible).
So what should I do in this case? One option would be to simply make the requested edits myself, adding information about each stream and incorporating the method for printing to stdout
found in the next-highest-rated answer. I suspect that such a massive edit wouldn't get past the review queue, but I have enough rep that my edits no longer go through the queue. But since I suspect I would fail review if I were forced to undergo it, this seems like an extreme course of action--the "nuclear option," as I put it in the title.
That said, I don't like that googling "qt print to console" brings up that question as the first result, with a woefully incomplete top answer.
QT_NO_DEBUG_OUTPUT
is defined, but it shouldn't be "nuked". Kyle Strand appears to have made negative comments on many answers but not posted any answers of his own. My recommendation would be for Kyle to post an answer that he feels is correct and complete, and let the voting system do the work. (If it is a good answer then it'll pick up some momentum as people go there from this thread).