Visual studio for c++

Sep 2, 2015 at 7:00pm
Hi,i just now downloaded visual studio community but however there is no win32 console application under visual c++.Instead there is visual c# and under it there is console application.Which software i have to install to use c++?can some provid eme the link...there are only enterprise,community and code softwares available but no ultimate software

Sep 2, 2015 at 7:09pm
If you used the installer defaults, you didn't install the things you wanted. Run the installer again and choose the custom install option, make sure you select anything having to do with C++.

Also, it is best to use "Empty project" when creating a C++ project, don't use the broken "Win32 Console Application" option.
Sep 2, 2015 at 7:42pm
That's what I always use. It's a good default.
Sep 2, 2015 at 8:53pm
Thank you guys..i ran a simple program but command window is closing immediately as soon as it runs executable file.how to avoid this?
Sep 2, 2015 at 8:54pm
See the second post in the topic stickied to the top of this forum:
http://www.cplusplus.com/forum/beginner/1988/
Sep 2, 2015 at 9:47pm
you need to pause
Sep 2, 2015 at 10:21pm
Add this.
1
2
cout << "Press enter to continue...";
cin.ignore();
Sep 2, 2015 at 10:32pm
Pretty much every possible solution, from the ingenious to the moronic, has been gone over in that thread. I don't think there's anything left to add that hasn't been said before.
Sep 3, 2015 at 8:05pm
closed account (E0p9LyTq)
Also, it is best to use "Empty project" when creating a C++ project, don't use the broken "Win32 Console Application" option.

What do you mean by broken? Please explain.

The "Win32 Console App" template in VS 2015 Community doesn't seem broken to me. Yes, the default settings add in a bunch of extra files that I don't want or need, such as the files needed for pre-compiled headers, but the template creates a viable console app that when run from the VS IDE keeps the console window open when the program ends. The C/C++ "Empty Project" template doesn't have that feature. Run it from the IDE and it closes as if it were run from the Windows shell.

The "Win32 Console App" template has a one page wizard where someone can select "Empty Project," which add no files to the project and still gives the project the ability to keep the console window open when run from the IDE.
Last edited on Sep 3, 2015 at 9:04pm
Sep 4, 2015 at 10:30am
Yes, the default settings add in a bunch of extra files that I don't want or need, such as the files needed for pre-compiled headers

That's broken enough for me.
Sep 4, 2015 at 12:44pm
+1 mutexe. It's broken because it's annoying to use.
Sep 4, 2015 at 2:25pm
The console is not staying open because you are most likely running it with a debugger and no breakpoints so the console window closes after execution, there is a ways to fix this though. It is basically to run it without the debugger attached (Which shouldn't be a problem in most cases).

1) The most preferred option in my opinion is to just run your program inside VS by pressing CTRL-F5 instead of just F5. This will now keep the console open with a "Press any key to continue . . ." message when the program execution exits.

For this solution to work, you need to make sure you have the Console linker option selected "Console (/SUBSYSTEM:CONSOLE)". You can check this by following these steps.

1.Open up your project, and go to the Solution Explorer. 

2.Right click on your project in the Solution Explorer.

3.Choose "Properties" from the context menu.

4.Choose Configuration Properties>Linker>System.

5.For the "Subsystem" property in the right-hand pane, click the drop-down box in the right hand column.

6.Choose "Console (/SUBSYSTEM:CONSOLE)"

7.Click Apply


After that it should work perfectly for you. Though be warned again this will run the program without the debugger. If you do want to be using the debugger and also want the console to stay open when execution of your program is done you can run it normally with F5 and then just set a breakpoint at the return statement inside of your main() function.

Otherwise you can always go down the route others have mentioned with adding lines of code to your project to keep the console open. Hope this helps.
Last edited on Sep 4, 2015 at 2:30pm
Sep 4, 2015 at 6:49pm
closed account (E0p9LyTq)
The console is not staying open because you are most likely running it with a debugger

I was running using CTR+F5, I simply didn't know what the project/solution option was for the system linker. Now I know.

I personally still find it easier use the Win32 Console template and then specify an empty project from the settings wizard page.
Topic archived. No new replies allowed.