Console() not printing in app console window

This is an odd one but only some things printed with console() go to the apps console window (when setConsoleWindowEnabled is true).

It seems to be to do with order of initialisation, if things are printed during initialisation they are only printed in the Visual Studio console output and not the cinder app console.

Is there any way to force all console() prints (and CI_LOGs) into the app console? Or at least another way of printing information to the app console window during app member initialisation.

Thanks.

On Windows I usually set things up manually. In the project settings set the subsystem to Console (I think in linker settings). Then you need to replace the macro at the bottom of the main app.cpp file with your own main() function - you can unpack the macro into its WinMain function and it’s fairly simple to change. Let me know if you need help.

I’m not sure that this totally works for console() as I tend to just use cout and cert.

@felixfaire looks like you’re right, log info is only redirected to a dedicated window upon app launch(), which is after both the prepareSettings() function and App constructor are called. I think that could safely be moved to a method on PlatformMsw though, so you could call it as early as you like (or AppMsw could call the method in its static initialize() method, which happens before the app is constructed but after prepareSettings()).

Though thinking about it, the MSW-only dedicated console output thing was added before we had the current ci::log api. Maybe we should think about making all that it’s own Logger type, instead of functionality built into the app?

cheers,
Rich

1 Like