Homework #0 – Creating and Turning In Visual Studio Projects Solution

$30.00 $24.00

The purpose of this assignment is to make sure that everyone can create a Microsoft Visual Studio 2013 project and submit it to Moodle. This assignment looks very long, but it’s just a lot of easy-to-follow instructions. Just take it step by step and I expect you’ll be able to move through it very quickly.…

5/5 – (2 votes)

You’ll get a: zip file solution

 

Description

5/5 – (2 votes)

The purpose of this assignment is to make sure that everyone can create a Microsoft Visual Studio 2013 project and submit it to Moodle.

This assignment looks very long, but it’s just a lot of easy-to-follow instructions. Just take it step by step and I expect you’ll be able to move through it very quickly. If you have trouble, just let me know how I can help!

I recommend you try to finish this by the end of the day on Tuesday, so you have plenty of time to ask me for help on Wednesday if something goes wrong.

_______________________________________________________________________________

Exercise 1: Getting Started with Visual Studio 2013

Before you begin:

  • Installation may take your computer a couple hours, so get that set up (step 2 of this exercises) and then go have dinner or something.

  • If you don’t have a personal computer, no problem. You’ll need to do your work on campus machines (like in our classroom). Please skip to step 4 of this exercise.

  • Similarly, if you have trouble installing, please nevertheless do step 4 through the end on a machine in Julian, so that you’re familiar with how to use Visual Studio 2013. You can access Visual Studio 2013 by hitting the flag thing in the lower-left corner of the

Windows desktop, choosing “Programming”, “Visual Studio 2013”. (Not to be confused with “Blend for Visual Studio 2013.)

  1. For this course, you’ll need to download a copy of Visual Studio 2013 onto your personal computer. You can download it at: http://www.depauw.edu/academics/departments-programs/computer-science/software/

    1. Make sure you get Visual Studio 2013, not 2017! You’ll run into some compatibility problems with the machines in our classroom if you use 2017 on your laptop.

    1. If you have a Windows machine, you’ll be able to install Visual Studio 2013 directly.

    1. If you have a Mac, you’ll need to download it from a browser inside VMware or a similar program. Please follow the instructions at: http://kb.depauw.edu/?page_id=5683

Once you get that set up, open a browser in VMware, go to the “computer-science/software” link above, and download and run the Visual Studio executable file – all within VMware.

    1. Note that “Visual Studio 2013 Express” is not the same thing, nor is Visual Studio for any other year. Make sure you download Visual Studio 2013 at the link above.

  1. Run the .exe file you download. When asked about “Optional features to install”, note that we won’t be using any of those in this course, so you don’t have to install them unless you want to play with them on your own.

    1. Unfortunately, this installation process can take at least 30 minutes, so I recommend you find something else to do while the program is installing.

  1. IMPORTANT: What you just installed is actually the 30-day trial version. We have keys for you to make your installation the full, permanent version, but we’re not legally allowed to give them out. The key has to be typed in for you. To get the key typed in, please make an appointment with Cory Puckett (corypuckett@depauw.edu) and bring your laptop to get this done. You must do this within 30 days of installation, or your installation will stop working at that point!

    1. You don’t have to get the key entered before you turn in this assignment. Just make sure you get this done within 30 days of installation.

  1. Once you get it installed, start it up. It might ask you if you want to sign in, but feel free to just choose “Not now, maybe later.”

  1. For “Development Settings”, choose “Visual C++”. Choose whatever visual theme you like.

  2. Once it’s up and running, feel free to close the “Start Page” tab if you want.

  3. Choose File –> New –> Project…

  1. In the option tree area on the left, make sure that Installed –> Templates –> Visual C++ is expanded and Visual C++ is selected.

  2. In the middle area, choose “Empty Project”.

  1. At the bottom right, just above the “Ok” button, make sure “Create directory for solution” has a check in the box.

  1. In the “Name” field at the bottom, enter lastname-hw0, filling in your last name, of course.

  1. Outside of Visual Studio, open the I: drive in File Explorer (the file browser thing). Go to

your personal folder on the I: drive, and make a folder inside it called “homework”. I recommend you keep all your homework files in subfolders inside this homework folder.

    1. Note: If you don’t see your I: drive, you may need to follow the instructions at http://kb.depauw.edu/?page_id=1287 (either on your Windows machine, or in Windows on VMware).

  1. Back in Visual Studio, hit the “Browse…” button, and select the homework folder you just made.

  2. Hit “OK”. Your project is now created!

  1. Let’s add a code file to it. In the left area, under lastname-hw0, you should see a folder called “Source Files”. Right-click “Source Files”, and choose “Add –> New Item”.

    1. If you don’t see the Source Files folder, first choose View –> Solution Explorer.

  2. Select “Visual C++ in the left, and “C++ File (.cpp)” on the right.

  3. In the “Name” field, enter “Hello.cpp”. It is very important that you never change the

Location” field at all when adding a new file. Hit the “Add” button.

  1. Paste the following code into your Hello.cpp file:

#include <iostream> using namespace std;

int main() {

cout << “Hello world!” << endl;

return 0;

}

  1. If we haven’t already talked about this code in class when you’re reading this, don’t worry. We’ll talk about it all very soon. For now just paste it in.

  2. Hit ctrl-S to save the file.

  1. Now we need to compile (“build”) the project. Select “Build Solution” from the Build menu (shortcut: F7).

    1. If you have already built it before, select “Rebuild Solution” instead. (shortcut: ctrl + alt + F7)

    1. If you want to rebuild and run all at once, you can just do ctrl + F5, and say “yes” when prompted to rebuild.

    1. If you ever receive a compilation error that mentions a “link error” or includes “LNK” in an error identifier, the first thing I’d recommend trying is to choose “Rebuild Solution”.

      1. Sometimes that will take care of it.

      1. If not, then the error is probably something you made a mistake with. Look especially in your #include statements, that what you’re trying to include actually exists and that you have no typos.

  1. To run the program, choose Debug –> Start Debugging (shortcut F5), or hit the green-arrow button on the task bar.

  1. You might notice that a black window pops up for a moment and then disappears before you can see what happens. There are several ways to prevent this, making the program

freeze” right before it finishes so you can see what is output.

  1. The way I’ll recommend is to add a breakpoint to the return 0; statement. Do this by clicking the darker area just to the left of the code. See in the image below where I have a red circle? That indicates that I have a breakpoint on that line. Click at that spot in your Visual Studio project to make a breakpoint appear for you at the exact same place.

  1. A breakpoint is a place where you’re telling the program to stop while you debug. Here we’re just asking the program to stop before it executes the return 0; statement and the program terminates.

  1. Now try running your code again. The black window will stay open, and you should see the message “Hello world!” in that window. (The black window might get covered up by the Visual Studio window, so you might think it’s gone, but you can select the window again from the taskbar at the bottom of the screen.)

  1. IMPORTANT: Your program is still running. To allow it to finish, hit the “Continue” button with the green arrow, in the task bar. Or you can choose Debug –> Continue, or hit the shortcut, F5.

  1. By choosing “Continue”, you allow the program to continue, and thus complete in this case, and so the black output window closes and the program is done.

  1. And you’re done! I know that seems like a lot of steps, but don’t worry. Very soon it’ll be super easy for you. You’ll just fly through this in no time. 🙂

What if Visual Studio isn’t working on my computer?

If for some reason something isn’t working for you, please contact me immediately and we’ll work it out. And remember that you do have access to Visual Studio in JSC 108, 109, and 278 – you can go to those rooms to work when there’s not a class in there. So if Visual Studio breaks or something while you’re working on homework this semester, please plan on working in the classroom to get the assignment done on time.

_______________________________________________________________________________

Exercise 2: Turning In Your Code Via Moodle

Even if you’ve used Moodle before, there are a few things to be aware of when submitting a Visual Studio project, so please read these instructions carefully.

  1. Make sure Visual Studio is closed (not just minimized). If you leave it open during the following steps, things may not work properly.

  1. In the File Explorer (the file browser thing), right-click on the folder that contains everything for your project. It should be called lastname-hw0, and be in your I: drive personal folder. Choose Send to –> Compressed (zipped) folder. A new file called

lastname-hw0.zip will be created.

    1. You really do need to zip up everything about your project: the .sdf, .sln, and

.suo files, the Debug folder and everything in it, and the inner lastname-hw0 folder and everything in it.

  1. Now, to test things out:

    1. Right-click on lastName-hw0.zip and choose copy. Then right-click in a different folder (for example, the desktop) and choose paste.

    1. Right-click on the lastName-hw0.zip file you just pasted, and choose Extract All…

    2. Hit the Extract button.

    1. Open up the folder that was created. Find the projectName.sln file and double click on it. Visual Studio should load the project.

    1. Compile and run the program and make sure it still works.

    1. If it doesn’t, then your zip file doesn’t contain everything it should! Go back to step 2 and make sure you include the highest-level project folder, the one that contains everything, and make the zip again.

    1. Note: You won’t be able to load your project in Visual Studio from inside the zip file. You have to extract it from the zip file and open that extracted project.

  1. Ok, so you’ve tested lastName-hw0.zip and it works fine. Now, log into Moodle and go to our course page.

  1. Choose the “hw0 submission” link, and upload your lastName-0.zip file.

_______________________________________________________________________________

Exercise 3: What If Moodle Doesn’t Work?

For this assignment, and any future assignment…

  1. If for whatever reason Moodle is causing problems – it won’t load, won’t let you submit, etc. – then please email your zip file to me. Do not let a due time pass because of

Moodle problems!

  1. The one complication to this is that with DePauw mail servers, .exe files are not allowed as attachments – even when they’re inside of a .zip. Unfortunately, Visual Studio projects contain an .exe file. So to get around this problem, we’ll just delete it.

    1. It’s ok to do this – the .exe file will be automatically regenerated every time you compile, so it’s ok to delete it right before making a .zip and emailing the .zip.

  1. The .exe. file is in the Debug folder. Confusingly, there are actually multiple Debug folders, but the one you want is probably the first one you’ll see. So find the Debug folder that has the lastname-hw0.exe file.

    1. The .exe file will have the extension .exe, and will be of type “Application” according to Windows.

  1. Delete the .exe file.

  1. Then create the .zip as described in the previous problem. This would be the file you could email to me if Moodle is having problems.

  1. Please practice this now. To practice, email the .zip with the deleted .exe to yourself just to make sure you’re able to do so. If you don’t practice it now, then precious minutes will pass and points will slip away as you try to figure out how to do this sometime later in the semester.

  1. If you have any trouble with this, please let me know! I’d be happy to walk you through it in person.

Homework #0 – Creating and Turning In Visual Studio Projects Solution
$30.00 $24.00