CS3240: Data Structures and Algorithms

How to use Microsoft's Visual Studio .NET to create a C++ Win32 Console Application

To create a new project and add a source file

  1. Create a new project:

    On the File menu, point to New, then click Project….

  2. From the Visual C++ project types, click Win32, then click Win32 Console Application.

  3. Enter a project name.

    By default, the solution that contains the project has the same name as the new project, though you can enter a different name. You can enter a different location for the project if you wish.

    Click OK to create the new project.

  4. In the Win32 Application Wizard, select Empty Project and click Finish.

  5. If Solution Explorer is not visible, click Solution Explorer on the View menu.

  6. Add a new source file to the project:

    • Right-click on the Source Files folder in Solution Explorer and point to Add and click New Item.

    • Click C++ File (.cpp) from the Code node, enter a file name, and then click Add.

    The .cpp file appears in the Source Files folder in Solution Explorer and a tabbed window appears where you type in the code.

  7. Click in the newly created tab in Visual Studio and type in a valid C++ program that uses the Standard C++ Library, or copy and paste code you created before.

    (For example, you can use the set::find (STL Samples) sample program in the Standard Template Library Samples topics in the help. See How to: Compile a Code Example from the Help Topics for information on copying a sample program to the Clipboard.)

  8. (If you use the sample program for this procedure, notice the using namespace std; directive. This allows the program to use cout and endl without requiring fully qualified names (std::cout and std::endl). )

  9. On the Build menu, click Build Solution.

    The Output window displays information about the compilation progress, such as the location of the build log and a message indicating that the build succeeded

  10. On the Debug menu, click Start without Debugging.

    (If you used the sample program, a command window is displayed that shows whether certain integers are found in the set.)

 

© Lynne Grewe