Homework: Visual Studio
|
|
Next > |
Note: To submit this homework, you need to use your
personal CS account. The username for your personal CS account is the same as your pipeline ID (usually two to three letters, a single digit followed by a letter). If you don't have a CS account that matches your pipeline ID, request one at
https://mgt.cs.mtsu.edu/aru/.
It may take a day or two to create your account!
Introduction
The purpose of this assignment is to help you become (or verify that you are) familiar with Microsoft Visual Studio 2012.
Creating a project
- To create a new project, select File::New::Project ...::Visual C++::Win32 Console Application (meaning the File menu option, then New menu item, etc.)
- Give your project a name (e.g., carroll-hwkVisualStudio).
- Select an appropriate drive location (i.e., your flash drive).
- Make sure "Create directory for solution" checkbox is NOT checked.
- Click the "OK" button.
- Click the "Next" button.
- Under "Application type" select "Console Application".
- Under "Additional options" select "Empty Project" (if you don't it will create several files).
- Click the "Finish" button.
Creating files and adding them to a project
- Select Project::Add New Item ...
- Select the type of files that you are creating. (Code::C++ file (.cpp) or C++ header file (.h))
- Give your file a name.
- Click "Add".
- Type in the code in the editor window.
- Save the code (CTRL + S).
Adding existing files to a project
Visual Studio can
link files that already exist on a computer to be part of your project. Linking does not copy the files into project. To ensure that the files are submitted with your project use the following steps.
- Make a new directory named src within the project directory (e.g., carroll-hwkVisualStudio/src).
- Copy the file(s) that you wish to include into the project into src.
- Select Project::Add Existing Item ...
- Select the file(s) in the src directory that you want to add.
Do not use "Add existing files" for projects that you're going to submit. The problem is when you make the zip file, the actual file is NOT in that directory and therefore it is not in the zip file!
How to create the executable file
- Click Build::Build Solution or Build::Rebuild Solution. (Compiles and links)
How to execute your program
- After an executable file have been created (program has been compiled and linked successfully), press CTRL + F5 or select Debug::Start Without Debugging.
Assignment
- Read the following tutorial steps above for creating a C++ project in Visual Studio.
- Name your project <yourlastname>-hwkVisualStudio. For example, if my last name were Carroll (and it is), then for me it would be carroll-hwkVisualStudio.
- Create new files into your project that have the same new and contents as the following:
- Compile and execute your project and make sure you assignment works properly.
- When you are read to submit your assignment, close Visual Studio and delete the debug and ipch folders and .sdf (SQL Server Compact Edition Database) files in the project folder (if they're present). (These directories and files will be automatically regenerated if needed.)
- Zip the whole project directory (e.g., by right-clicking on the folder and choosing send to::Compressed (zipped folder) in Windows Explorer). Name your zip file as hwkVisualStudio.zip. If you added existing files instead of creating new files, make sure that they are contained in the project directory.
- Your program must compile and run in both Visual Studio 2012 or newer and on ranger. On ranger, it must compile with the following command:
g++ -std=c++0x *.cpp -o hwkVisualStudio
- Submit the assignment (see instructions below).
Notes
- Microsoft's Visual Studio version 2012 or newer is required for this course. You can get a copy of Visual Studio by at least one of the following:
- Get a free version of Visual Studio 2015
- Get it free through DreamSpark (which has already been set-up for you). Click on the "MSDNAA Login" link at https://cs.mtsu.edu/ if you haven't already got an email. If you don't have a password, click on the reset password link.
- Buy Visual Studio
- Submitted by a previous student: When you have both Visual Studio 2012 and Visual Studio 2010 installed on the same machine, the linker for 2010 doesn't work properly (at least on my machine) unless you set the INCREMENTAL to no. To access that option in 2010, you go to the "Project" tab, go to " properties". From there, you can access the linker and set it "no". But, this is only an issue if you have both 2012 and 2010, and it only affects certain computers. When you set it to no, you get the following information when you build a program (it ignores the link error and the program will work).
1>card.obj : warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/INCREMENTAL:NO' specification
Submission
Submit your zip file at
https://3110.cs.mtsu.edu/ (using your "personal" CS account credentials). For further instructions, please see the
Miscellaneous page.
Rubric:
Points Item
---------- --------------------------------------------------------------
_____ / 2 Project has appropriate files added
_____ / 2 Removed debug and ipch folders and any .sdf files
_____ / 6 Project compiles and executes properly in Visual Studio and on ranger
_____ / 10 Total
Last Modified: