Visual Studio .NET
Microsoft Visual Studio .NET is installed on the SEASnet machines, so if
you're willing to work only on those machines, you do not need to install
anything.
If you have another C++ compiler (e.g., g++ under LINUX) on your own
computer, and you do not want to install Visual Studio .NET, you are free to use
your own compiler during the course of your program development, but you
must ensure that what you turn in will compile and run
correctly under Visual Studio .NET. Be sure you budget enough time to transfer
your program files to a SEASnet machine and fix any portability problems.
Obtaining Visual Studio .NET
If you would like to use Visual Studio .NET on your own computer, Microsoft
has made it available
at no cost to you through the MSDN Academic Alliance program.
You may pick up your free copies of the installation CD's
from Julie Austin at BH 2567, Mon--Fri 9am--4:30PM except 12--1PM lunch.
You may need
to first download and install the Windows Component Update for Visual Studio
.NET from the same site.
Alternatively, you may download the software from the SEASnet site.
The download of Visual Studio .NET on a broadband connection proceeds fairly
quickly to 99%. It then sits there for another ten to fifteen minutes before
finishing. Don't cancel the download too early.
Creating a Visual C++ Project
Visual Studio .NET is designed to support developers of large systems, so to
use it as we will initially to write simple one-file programs may seem like
overkill. However, over time you will come to appreciate some features (the
debugger, especially).
Here is a way to set up a Visual C++ project to compile and run a simple
one-file program. A number of these steps may have alternate ways to achieve the
same end.
- Start up the Visual Studio .NET IDE. If you don't have a shortcut on the
Desktop, then from the taskbar you'll probably select Start / Programs /
Microsoft Visual Studio .NET / Microsoft Visual Studio .NET
- On the Start Page, select Get Started in the left panel, and click
New Project in the right. (Alternatively, from the menu, select File / New /
Project.)
- In the New Project dialog, in the left panel, select Visual C++
Projects. In the right panel, scroll down and select the bottom right choice,
Win32 Project. In the text boxes below, enter a project name, such as "hello".
So that you can more easily find your projects later, you might want to change
the Location to something like "C:\CS31" on your own machine, or "Z:\CS31" on
a SEASnet machine.
- When you click OK, the Win32 Application Wizard dialog comes up. In the left
column, click on Application Settings. Under Application type, choose the
Console Application radio button. Under Additional options, check the Empty
Project checkbox. Click OK.
- From the Project menu, select Add New Item. In the Add New Item dialog, select C++ file (.cpp) in the right
panel, and enter a source file name, such as "hello", in the Name text box
below.
- Edit the hello.cpp file in the window that appears. Type in a program like
#include <iostream>
using namespace std;
int main()
{
cout << "Hey, this really works!" << endl;
}
- From the Debug menu, select Start without debugging (with the red
exclamation point icon). This will save your source file, compile it, and run
it if there were no compilation errors. If you select the Start item (with the
blue triangle), your console window screen will disappear as soon as your
program finishes executing, which you don't want.
- If your program has any compile-time or link errors, the Task list window
below your source file will list the errors. Double click on the first error
message to see where it is in your code. Fix the error. You can click on and
fix other errors as well, but be aware that sometimes one mistake produces
multiple error messages. Go back to step 7.
- If your program runs, any output will appear in a new console window that
pops up. If everything looks good, press any key to dismiss the console
window.