Skip to content

make tools target the console subsystem on Windows

Thomas Debesse requested to merge illwieckz/netradiant:winconsole into master

Previously on Windows the stdout stuff was only printed on MinTTY console or SSH shell, this change makes the tools to target the console subsystem so they also print stdout on cmd console.

This also makes the tool spawning a cmd console windows when not started from a console, allowing people to monitor what is printed.

It's not very intuitive and explicit but the WIN32 cmake keyword in add_executable call is to not target the console subsystem but only the graphical one.

So console tools just have to not use that keyword, even if they may display in a window like when doing q2map -glview.

Then the WIN32 keyword is a kind of “no console” keyword.

This is a way to check if an exe targets the console subsystem or only the windows subsystem:

$ objdump -p netradiant.exe | egrep '^Subsystem'
Subsystem		00000002	(Windows GUI)

This is a way to check if an exe targets the console subsystem:

$ objdump -p q3map2.exe | egrep '^Subsystem'
Subsystem		00000003	(Windows CUI)

Note that this one targets console and only console is reported, but is expected to display a windows with -glview option:

$ objdump -p q2map.exe | egrep '^Subsystem'
Subsystem		00000003	(Windows CUI)

See it in action:

q3map2 in Windows console

Edited by Thomas Debesse

Merge request reports