Visual Studio 2010 C++ not displaying console output, despite console subsystem setting
Asked Answered
N

1

5

I've got a project that creates a console application, as part of a larger solution, however it won't display anything on the console. I've checked that /SUBSYSTEM:CONSOLE is set for both debug and release, and tried both std::cout and printf, neither cause any output to be displayed.

The whole VS solution consists of a couple of static libraries containing the underlying business code, and three executable - the main GUI (QT/OpenGL), the unit tests (boost), and this console app. Some of the library classes use Qt (mainly for signals/slots). Both the GUI and the Unit tests behave as expected (which, in the case of the tests, includes writing to console output ).

I've also tried adding a call to AllocConsole at the start of the main function - this causes a console window to appear, but there is still nothing being written - and yes, I have checked that the code is calling cout!

What else could be wrong? Is there another setting somewhere? or is Qt redirecting stdout without telling me?

Nairn answered 11/12, 2014 at 16:47 Comment(0)
N
7

It turned out that Visual Studio was over-riding the /SUBSYSTEM:CONSOLE setting with a /SUBSYSTEM:WINDOWS one in the Linker->Command Line->Additional Options page - deleting this made it work correctly...

Nairn answered 7/1, 2015 at 15:25 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.