EAS230 Microsoft Visual C++ 6.0 Tutorial Fall 2004 09/07/2004 Page 1 of 2 Microsoft Visual C++ 6.0 Tutorial Introduction Microsoft Visual C++ 6.0 (referred to as VC++) is a software development environment that allows a programmer to write, compile, link, execute, test, and debug C++ programs. This document describes how to use the VC++ environment. Launching Microsoft Visual C++ 6.0 ¾ Click on Start → Programs → Microsoft Visual Studio 6.0 → Microsoft Visual C++ 6.0 Creating a New Workspace ¾ Click on File → New in the toolbar. ¾ In the new window that pops up, select the Workspaces tab. Select Blank Workspace in the list. On the right hand side, type N:\EAS230 is in the Location field (this only needs to be done the first time you use VC++), then type Lab1 in the Workspace Name field, then verify that N:\EAS230\Lab1 is in the Location field, then click OK. Opening an Existing Workspace ¾ Click on File → Open in the toolbar. ¾ Select N:\EAS230\Lab1\Lab1.dsw and click OK. Creating a New Project ¾ Click on File → New in the toolbar. ¾ In the new window that pops up, select the Projects tab. Select Win32 Console Application in the list. On the right hand side, type in HelloWorld in the Project Name field. ¾ Select Add to current workspace. ¾ Verify that N:\EAS230\Lab1\HelloWorld in the Location field and click OK. ¾ Select An Empty Project and click Finish in the next window. ¾ Click OK in the New Project Information window that pops up. Opening an Existing Project ¾ Click on File → Open Workspace. ¾ In the window that pops up, go to N:\EAS230\Lab1 and select the Lab1.dsw file and click OK. Your projects are opened when the workspace is opened. Adding a New Source File to a Project ¾ Click on File → New in the toolbar. ¾ In the new window that pops up, select the Files tab. Select C++ Source File in the list. ¾ On the right hand side click Add to project and select HelloWorld and type in HelloWorld.cpp in the File Name field. Click OK. ¾ Click on the File View Tab in the Workspace. ¾ Click on the plus sign next to HelloWorld files, on the plus sign in front of Source Files, and then on HelloWorld.cpp.EAS230 Microsoft Visual C++ 6.0 Tutorial Fall 2004 09/07/2004 Page 2 of 2 Adding an Existing File to a Project ¾ Click on File → Open in the toolbar. ¾ In the window that pops up, go to N:\EAS230\Lab1\HelloWorld and select the HelloWorld.cpp file and click Open. ¾ Right click in the source code window and select Insert File Into Project → HelloWorld. You should see the file under Source Files in the Workspace. Building and Runing a Project ¾ Save the code ¾ Compile the code by clicking on Build → Compile HelloWorld.cpp. o If it compiles successfully, the window at the bottom of your screen will display HelloWorld.obj – 0 error(s), 0 warning(s). o If there are error messages, see the section on Debugging C++ Source Code below. ¾ Link the code by clicking on Build → Build HelloWorld.obj. o If it links successfully, the window at the bottom of your screen will display HelloWorld.exe – 0 error(s), 0 warning(s). ¾ Execute the code by clicking on Build → Execute HelloWorld.exe. o A window should popup with the output from your program in it: Hello World!!! Press any key to continue • Note: this line is put in automatically by VC++. Debugging C++ Source Code ¾ If you have compiler errors, click the mouse in the window at the bottom of your screen. To see the error message first, scroll to the top of that window. If you double click on an error message, the statement corresponding to the error message will be identified by a blue arrow in the coding window. ¾ Return to the coding window and correct the error. ¾ Recompile the program. Removing a File from a Project ¾ Click on the File View Tab in the Workspace. ¾ Click on the plus sign next to HelloWorld files and on the plus sign in front of Source Files. ¾ Make sure the source file is saved and then select the HelloWorld.cpp file and hit delete. This only removes the source file from the project and does not delete the actual source
View Full Document