Presentation on theme: "1 CSCI N305 C Language Programming Welcome to CSCI N305! Compiling Your First Program Using Microsoft Visual Studio 2008."— Presentation transcript:
1 CSCI N305 C Language Programming Welcome to CSCI N305! Compiling Your First Program Using Microsoft Visual Studio 2008
2 Objectives for the Lab ä Learn the difference between client-side and server-side programming ä Learn how to open an empty solution and project under Visual Studio.Net ä Compile and run a simple program
3 Client-side vs Server-side compiling ä Environment setup ä Install MS VS.Net 2008 from iuware.iu.edu ä Client-side compiling runs locally on your computer ä Requires installation of a compiler on your system ä Consumes local CPU and hard disk space ä No network (internet) connectivity required ä Service-side compiling runs remotely on a server ä Requires remote access software such as SSH available from iuware.iu.edu ä Server is typically more powerful CPU and has more storage. ä Typically used for larger projects ä Easier to implement team development environment ä Normally uses a command line interface rather than graphical ä Network (internet) connectivity required ä Used for business applications that require production infrastructure (production monitoring, nightly backups, etc.)
4 Start Microsoft Visual Studio 2008 ä Start → All Programs → Microsoft Visual Studio 2008 → Microsoft Visual Studio 2008
5 Starting for the first time ä The first time you run MSVS, you might get a window like this. ä Set Visual C++ Development Setting as your default environmental settings. ä Use General Development Settings if you have no preference.
6 Initial MSVS Window ä ä Here is an image of the initial window.
7 Opening a New Project ä Open a project using File → New Project → Visual C++ → Win32 → Win32 Console Application → enter your project name and browse to select a location (where your project will be saved) → OK.
Project Settings ä Choose Next > at this dialog.
9 Project Settings (continued) ä Be sure to check Empty project and Finish.
10 Add a New Item ä Right-click on Source Files and Add a New Item.
11 Create a.c File ä Choose Visual C++ Code, C++ File, enter a file name with.c as the file extension.
12 Enter Code into Your File ä ä Enter a standard C program into the.c file.
13 Save and Compile Your Program ä Save → Build → Build Solution
14 Save and Compile Your Program ä A successful build:
15 Save and Compile Your Program ä An unsuccessful build, read the error message and correct the errors and build again:
16 Run the Program ä After a successful build, Debug →Start Without Debugging to run the program:
17 Run the Program ä Examine the output:
18 Congratulations! ä You created a new Microsoft Visual Studio 2008 Project. ä Selected Visual C++ Win32 Console Application. ä Created your own.c file, entering code just like in class. ä Ran your program to produce output. ä You did all of this using an easy editor without logging onto the internet.
19 Open an Existing Program If your project is named projectOne: ä Find the projectOne folder at the location where you saved your project. ä In the projectOne folder, double click on the file projectOne.vcproj, or projectOne.sln. ä Double click on the.c file (e.g. main.c) will only open up the code file. It will not let you compile or run the program using Visual Studio 2008.
20 Submit a Program You only need to submit the.c file.