Building and Debugging with Visual Studio


This section examines creating a project for the T.E. Dickey Count program for Win32 using Visual Studio 6.0. (You should already have Visual Studio 6.0 installed on your system prior to running this example.)

First, you must create a Visual Studio project.

To create a Visual Studio project

  1. Start Visual Studio 6.0.

  2. Create a directory for the count project. For this example, create a Samples directory in your My Documents folder. If you are using the C drive, the fullpath is C:\Documents and Settings\< CurrentUser >\My Documents\Samples\.

  3. Start Visual C++ 6.0.

  4. Create a new project: on the File menu, click New .

  5. Click the Projects tab. In the Location box, enter the path for the new project directory. In this example, the path is C:\Documents and Settings\< Current User >\My Documents\Samples.

  6. In the Project Name box, enter the name of the project. For this example,use vscount.

  7. Click Create New Workspace .

  8. In the Platforms list, select the Win32 check box.

  9. Select Win32 Console Applications from the list box, and click OK .

  10. A new dialog box will appear with the title Win32 Console Application “ Step 1 of 1 . Click An Empty Project , and click Finish .

    A summary dialog box will appear with the following information:

    Win32 Console Application will create a new skeleton with the following specifications:

    +Empty console application

    +No files will be created or added to the project

    Project Directory:

    C:\Documents and Settings\<Current User>\Samples\vscount

You now have a Visual C++ 6.0 empty console application project and are ready to populate the project with the count source files.

To populate the project

  1. Download the count source from the following Web site:

    http://dickey.his.com/c_count/c_count.html

  2. This site contains a gzip tar file. Extract the gzip tar file to a temporary directory. (WinZip will perform the extract.) Copy the following extracted files to the project directory you created.

    • Source files ” c_count.c (extracted in the c_count-7.7 directory), getopt.c (extracted in the c_count-7.7\porting directory)

    • Header files ” patchlev.h and system.h (extracted in the c_count-7.7 directory), getopt.h (extracted in the c_count-7.7\porting directory)

  3. Now you are ready to add the count source files to the empty project, as follows :

    1. In the Visual C++ 6.0 Project Explorer window, click the File View tab. This is usually on the left side of the project workspace. Expand the tree view for vscount by clicking the + character. If the “ character is shown, the project folders are already in view.

    2. Select the Source Files folder.

    3. On the Project menu, point to Add to Project , and then click Files . The Insert Files into Project window appears.

    4. Navigate to the directory that contains c_count.c and getopt.c. For theexample, this is the C:\Documents and Settings\<Current User>\Samples\vscount folder.

    5. Select the files to insert into the project.

The program is now ready to compile. Visual C++ automatically selects Win32 Release and Win32 Debug as available configurations to compile and sets Win32 Debug as the active configuration. You can add other configurations by selecting Configurations on the Build menu. A window will appear that lists the two available configurations, and allows an option to add configurations. However, for this the example, Win32 Release and Win32 and Win32 Debug are the only configurations needed.

Although the project automatically sets Win32 Debug as the active configuration, you can easily change this by selecting Set Active Configuration on the Build menu. The Set Active Project Configuration window will appear. To change the active configuration, highlight the desired configuration in the list, and click OK . However, for this the example, no change is needed.

To compile the project, select Build vscount on the Build menu or press the F7 shortcut key. If you don t change any of the Visual C++ default compile and link settings, the build will report the following in the output window. This particular set of source generates one warning, but otherwise builds cleanly.

 Deleting intermediate files and output files for project 


UNIX Application Migration Guide
Unix Application Migration Guide (Patterns & Practices)
ISBN: 0735618380
EAN: 2147483647
Year: 2003
Pages: 134

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net