Faced with the problem of cmd crashing when C++ code is compiled in Visual Studio 2010, PHP editor Xiaoxin has specially compiled a detailed operation guide to solve this problem for you. In this guide, we'll walk through the potential causes of this issue and provide proven solutions. Continue reading below to learn how to successfully resolve this issue so you can smoothly edit C++ code in Visual Studio.
1. Open the vs2010 (Visual Studio) software, click File->New->Project, and click the small triangle on the left side of Visual C++ in the pop-up dialog box, which means that the new project is C++.
2. After expanding, click General, then click the empty project, then enter the name of the project to be created in [Name] below, and click [Browse] behind [Location] 】button to select the location where you want to store the project.
3. After completion, you can see the new project in the [Solution Explorer] on the right. The project name is the name you just gave yourself.
4. Right-click on [Source File] in the project, then click [Add]->[New Item], click the C++ file in the pop-up dialog box, and click Enter the name and location below, click Add, and then write the code in the pop-up edit box.
5. After writing a small program, when you click the green triangle run symbol above, you will find that the pop-up cmd flashes and disappears. The solution is to click Project->Properties (what is the project name, that is + properties).
6. In the pop-up dialog box, click Configuration Properties->Linker->System, select the console (/SUBSYSTEM:CONSOLE) in the subsystem on the right, and click OK, press Ctrl+F5 to run at this time to make cmd stay.
Note: You must press Ctrl+F5 to stop cmd, otherwise it will still crash.
The above is the detailed content of Detailed operation explanation of editing C++ in vs2010 (Visual Studio) and solving cmd crash problem. For more information, please follow other related articles on the PHP Chinese website!