Creating a simple program in Microsoft Visual Studio 2015

Today we're using Visual Studio 2015 to write and execute a simple C++ program. The steps are essentially:

  1. Have access to Visual Studio 2015. We don't need to worry about this today because we were in the PIC lab, where VS2015 is already set up. (We just needed to be careful not to accidentally use VS2013 instead.) To work on your own home computer, you probably want to download the free Community Edition of VS2015. You can do that here after a little messing around. Alternatively, you can go here to grab the newer VS2017. The difference shouldn't matter too much for this class, but I recommend the 2015 version because that's the "official" one for this class. In particular I'll use it during discussion and the grader will use it for your homework.
  2. Create a new project, add a .cpp file for code, type a program, build the project, and run your program! Really these are all separate steps, but I'm listing them together because this tutorial should help with all of them. It's technically meant for VS2012 but that shouldn't matter for this example.

My program won't build!

If the Build step gives an error message, you may have a mistake in your code OR you may have made a mistake during the creation of the project. Try starting over, being extra sure to pick "Visual C++" and then "Win32 Console Application" and to create an empty project. (See steps 3 and 4 in the tutorial.) To check that your project is empty, look at your Source Files and Header Files in the solution explorer. The only thing there should be the HelloWorld.cpp that you created yourself.

More cool stuff to try: