In the .NET compiler (csc.exe) I can use the option /target:exe to compile into an exe that will keep the console open so that I can see some stderr or `stdout“ output. However I cannot achieve this same functionality using the C/C++ compiler (cl.exe).
My program uses WinMain which means it’s an entire UI application. That’s why I need to keep the console.
the flag you need to create a console application is
/subsystem:console, check out the MSDN documentation about it. and it is actually a flag for the linker stage:you can however tell the compiler to use certain flags when invoking the linker:
since you need a
main()to make the link work, provide a simple one that callesWinMain()