I'm using Visual Studio 2022 Community and have created an empty "Windows Desktop Wizard" application. I've right-clicked the main project > "Properties" > "Linker" > "System" > "Subsystem" and set this value to "Windows (/SUBSYSTEM:WINDOWS)".
The code compiles and builds but when I run the executable, I don't see any of the cout statements. Is there any VS settings I should set? Or have I misconfigured my project?
I just want to create a basic windows app, be able to use features from <windows.h> header, and interact with the app via console.
By default a Windows gui program doesn't have a console. If you don't need a gui display it's easier to just have a console project. Change L15 to
int main() and set Subsystem to Console. If you do want a gui then after L16 insert AllocConsole() to get a console.
if the subject comes up, you can use the console in windows programs and windows in console programs if you really want to (you have to jump through some hoops to do so, but its possible). Usually mixing these is kind of dumb, but on occasion I have had a console program throw a messagebox pop up -- no reason not to, and it gets your attention :)
It is also handy sometimes to use the console in windows programs, but you usually want to do that *silently* such that the console is hidden. An example is to get the output of a console program that you called in the background.
for now keeping to console programs is probably ideal, but in the back of your mind, know that you can mix if you want to.
FYI, using system("pause") is frowned upon for keeping a console window open. Read the "Console Closing Down" topic. All of it. https://cplusplus.com/forum/beginner/1988/
From what is suggested in that topic I crafted a header only library toolkit for pausing the console window from closing down.
C++26 will redefine std::to_string in terms of C++20's std::format, so using std::format might be something worthwhile, its flexibility to being overloaded for custom types for example.