Preventing console window from closing on Visual Studio C/C++ Console application

前端 未结 21 1717
灰色年华
灰色年华 2020-11-21 23:42

This is a probably an embarasing question as no doubt the answer is blindingly obvious.

I\'ve used Visual Studio for years, but this is the first time I\'ve done any

21条回答
  •  挽巷
    挽巷 (楼主)
    2020-11-22 00:02

    In my case, i experienced this when i created an Empty C++ project on VS 2017 community edition. You will need to set the Subsystem to "Console (/SUBSYSTEM:CONSOLE)" under Configuration Properties.

    1. Go to "View" then select "Property Manager"
    2. Right click on the project/solution and select "Property". This opens a Test property page
    3. Navigate to the linker then select "System"
    4. Click on "SubSystem" and a drop down appears
    5. Choose "Console (/SUBSYSTEM:CONSOLE)"
    6. Apply and save
    7. The next time you run your code with "CTRL +F5", you should see the output.

提交回复
热议问题