CMPS160, Fall 2013, Section 01: Lab 1 Setup Tutorial

Microsoft Visual Studio Setup for Lab 1

Note: Lab 1 comes with a MSVC++ 2012 .sln file already included. Double-clicknig on that file on a lab computer should open it and get you ready to code. This tutorial explains how that .sln file was created, in case you want to create your own (perhaps for a future lab). Don't follow these steps if you just want to start coding on Lab 1 immediately.

The below demo brings you to the state of the solution file (the starter file in, which runs on the lab computers.

Step 1: Run visual studio

From the desktop, open the "Software" folder, then "Programming", then "Microsoft Visual Studio 2012" then open "Visual Studio 2012"

Step 2: Your first program

From the start page, click "New Project", then in the window that pops up, expand the "Visual C++" option.  Select the "Win32" subcategory and then pick "Win32 Console Application”, and enter a name for your project (e.g. "Lab1").  Be sure to change the Location to your home directory or a flash drive- the default location won’t save your files after you log off.

After you hit "Ok", the Win32 Application Wizard will pop up, hit "next", then uncheck the "Precompiled Headers" option, uncheck the "Security Development Lifecycle (SDL) Checks" option, check the "Empty Project" option, and hit "Finish".


Step 3: Adding the source files to your Visual Studio project

You will need to add the .cpp files into the "Source Files" folder (Lab.cpp, ppm_canvas.cpp), and the .h file (ppm_canvas.h) into the "Header Files" folder. It's easier if you move the files to that folder before adding them to the project. The .sln file and project file keep references on each file and its role in the project. Moving these files after adding them will cause errors.

Add the some.ppm file to the "Resource Files" folder.

Step 4: Add the command line arguments

Click the "Project" dropdown menu and click on "<your project name> Properties" at the bottom.  This will open the "<your project name> Property Pages" window.  Expand the "Configuration Properties" and click "Debugging".  In the right-hand pane, click in the "Command Arguments" field. You'll need to ender the location of the file "some.ppm" relative to the location of the ".sln" file that you just created. For example, if you used the directory that "some.ppm" was in as your project directory this would just be "some.ppm", but it might be "..\some.ppm" if your .sln file is in a directory inside of the one containing "some.ppm." Once you've done that, hit "Ok".

Step 5: Make sure glut is installed

There are three components to glut on windows: the header files, the libraries and the dll. They can both be downloaded from

The lab computers already have glut installed, but if you're working on a different computer, you'll need to install it. For MSVC 2012 on a 32-bit Windows 8 machine, the proper directories should be as follows (The '*' matches your version of VS: 11.0 for VS2012, 10.0 for VS2010, 9.0 for VS2008). On a 64-bit machine, you should replace "Program Files" with "Program Files (x86)".

".h" (Header) files goes in the VC++ include directory (C:\Program Files\Microsoft Visual Studio *\VC\include\GL\glut.h). Note that you may have to create the "GL" folder.

".lib" (Library) files go in the VC++ library directory (C:\Program Files\Microsoft Visual Studio *\VC\lib\glut32.lib).

".dll" (dynamic link library)files must be reachable by the .exe file; i.e. in System32 on 32-bit machines, SysWOW64 on 64 bit machines, or in the project directory (on lab machines these files are currently in the System32 directory.


Note that the VC++ Directories tab of the solution properties window has a list of paths that it searches for each of the required file types.

Step 6: Cross your fingers and run for the first time!

Hit the “f5” key, or click the little green arrow in the top menu bar to run. Make sure you're running in Debug mode (should be the default), since the command-line option we added is only used in that mode.

When run, a console window should pop up and print the color of a pixel, and a black window will pop up in front of that.

If it didn’t work, or the directions aren’t clear please post your questions on piazza!