1 / 43

CS2311 - Tutorial 1

CS2311 - Tutorial 1. Getting Started with Visual Studio 2010. Outline. Introduction and installation of Visual studio (VS) Writing, compiling, and executing C++ programs using VS Introduction E-portal and content collection. Working Environment.

Download Presentation

CS2311 - Tutorial 1

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CS2311 - Tutorial 1 Getting Started with Visual Studio 2010

  2. Outline • Introduction and installation of Visual studio (VS) • Writing, compiling, and executing C++ programs using VS • Introduction E-portal and content collection

  3. Working Environment • In this course, you will be working with PC under Windows 7 or XP, and all the programs will be written with Visual Studio 2010. • In this tutorial, you will explore and get familiar with the MS Visual Studio 2010 compiler working environment. • Visual Studio 2010 is an integrated developing environment (IDE). Inside the Visual Studio 2010 compiler, you can edit, compile, link, run, debug and manage your programming projects.

  4. Setting up Visual Studio Environment (In CSC Labs) • Locate Microsoft Visual Studio 2010 from the WorkDeskicon on Desktop. • Visual Studio 2010 professional and Visual Studio 2010 professional ultimate are similar IDE and both of them can be used in this course

  5. Outline • Introduction and installation of Visual studio (VS) • Writing, compiling, and executing C programs using VS • Introduction E-portal and content collection

  6. Steps for writing, compiling and running c programs • Create a project and project folder • Create a folder for storing programs (source code) • Add the source code to project • Compile and run the program

  7. Create the project Select File Mouse over New Click Project…

  8. Create a C++ Console Project 2: SelectWin32 Console Application 1: SelectVisual C++ 3: Select the folder where you want the project saved e.g. c:\user\<your login ame>\documents\Visual Studio 2010\Projects 4: type a folder name, e.g. tut1 4: uncheck “Create directory for solution” 6: click OK

  9. Customize the project setting click Application Setting

  10. Customize the project setting 1: check Empty project 2: click Finish

  11. Add a C++ program file into the project 1. Right click Source Files 2. Mouse over Add 3. Click New Item…

  12. Add a C++ program file into the project 1: select C++ File(.cpp) 3: click Add 2: enter a file name, e.g. tut1

  13. Writing code The area for typing project code The cpp file just created

  14. Writing code Type the Hello World program

  15. Build (Compile) your program [F7] click Build Solution

  16. Build your program If the program can be built successfully, you will see 1 succeeded here

  17. Execute your program [Ctrl+F5] click Start without Debugging…

  18. Result of Execution

  19. Try it out! Comment this line

  20. Rebuild the project [Ctrl+Alt+F7] This time, click Rebuild Solution because the project has been built before

  21. Got an error message 0 succeeded, 1 failed means the program has problem! No executable is made

  22. If you try to execute it anyway..

  23. You will get an error message

  24. And will not have an expected result

  25. A better way: Locate the error A maker will be placed beside the line that makes program failed to build Double click the error message

  26. Fixed the error Add std:: before cout, it tells the compiler the cout object is defined in std namespace

  27. Rebuild the project: Fixed! It is success this time!

  28. Copy your project out Locate your project (the path may be different if you choice different path in project creation Copy the whole folder into your USB or elsewhere

  29. Reload your project Close it first!

  30. VS without project loaded Click File >> Open

  31. Locate and select your project 1. Select tut1.sln from the project folder you copy before Click Open

  32. Your project is loaded

  33. Work on other program with the same project • Within the same project, we can only have one “main” function. If you want to add another program file with function main, exclude the existing one first!

  34. Schedule • Introduction and installation of Visual studio (VS) • Writing, compiling, and executing C programs using VS • Introduction E-portal and content collection

  35. Uploading your programs to the e-portal content collection • Login to e-portal • Click content collection • Click "Add Item" • Select the file (with extension .c, e.g. Hello.c) and click "submit"

  36. What you have done in this Tutorial • Create a Visual Studio 2010 Project • Create and add a C program into the project • Write a simple Hello World Program • Build and Execute the program • Locate the syntax error of a program

  37. Downloading a Visual C++ 2010 compilers (try it yourself at home) • Visual Studio 2010 can be found at: http://msdnaa.cs.cityu.edu.hk/ • Login using your student ID as login name and password. • Click "MSDNAA Software Center" • Select Visual Studio 2010 Professional Edition • Add the following items to the shopping cart • Visual Studio 2010 Professional Edition DVD • Download and run the executable files. • Burn the iso files to DVDs (or using software to mount the DVD image). • Click setup to install.

  38. You have to ….Trust us  Click this

  39. Enter your CS lab account (Check the email sent by CS Lab first)

  40. Enter the MSDNAA Software Center Click this

  41. Select Visual Studio 2010 1. Select Developer Tools Select Visual Studio 2010

  42. Download the Professional Select Visual Studio 2010 Professional

  43. Add VS2010 to shopping cart Click Add to Cart and then check-out

More Related