Visual Studio 2010 at UoM

Getting started on Visual Studio 2010
On windows one of the best IDEs (Integrated Development Environment) to use on Windows is Visual Studio 2010. Visual Studio is primarily written for developers to build complex applications using graphics, audio and interactions with the user. However, during this course we are only interested in coding mathematics, so will not really touch on the many things that Visual Studio can do for you. You will need to know how to edit, compile and run simple Win32 console applications.
The following "How To" is for the Windows network at the University of Manchester. First click on the start menu and type "visual", you should see Visual Studio 2010 appear to select.


Once the program has loaded, select the "Visual C++ Development Envionment" from the menu and start the program. Now go to the menu and select to open a new project, each and every time you want to create a new program you will need to go through this same process, so bookmark this page for future reference.
Select "Win32" from the left hand menu and "Win32 Console Application" from the center. Then fill in a name for the project in the space provided. I have called this project "Hello World 092012".
Now a window should open to configure the settings. It is a good idea that you get used to creating files in your project so select "next" rather than "finish" and then tick the checkbox for "empty project".
Click finish and your project will be created. You may should see a warning that the project should not be created on a network drive and a fallback directory will be used. Check the "Do not promt again" if you do not want to see this every time you open a new project. Click "ok" to accept the settings.
If you run into problems compiling your projects you should view the "How To" on compiling the projects on the local drive. Now we should have our empty project opened, we must add a main file to the project. There must be ONLY one main file in every project. If you want to solve a different problem you must open a NEW project. Right click on "Source Files" in the left bar and select "Add" then "New Item" from the menu.
Now the "Add New Item" window will appear. Select "Code" from the left hand bar and select "C++ File (.cpp)" from the center. In the name promt at the bottom name the file as "main.cpp" and click add
Go to the editor and enter the following text:
// include the input output stream library
// so that you can write to the screen
#include <iostream>
// use the std namespace
using namespace std;

// all programs must have just ONE main function
//
int main()
{
// output a message to the screen
cout << " Hello world!!!!!\n";
// finish the function by returning an integer
return 0;
}
Once the code has been entered correctly you should be able to compile and run your program. Go to the debug menu at the top and select "Start Without Debugging".
Finally you should see a terminal appear with your message inside (along with some other stuff!!).
If you have any problems compiling the code try to change the compile directories as outlined here (Changing Compilation Directories on Visual Studio).

Comments

Popular posts from this blog

Exclusive Interview: 2011 8TV Hot Chef (美食型男) Jason Cha

Career Lessons from Breaking Bad

Things We Now Know