Share via


Building a Single File Without a Project Workspace

Home Page (Projects)OverviewsHow Do I... TopicsNMAKE Reference

You can create a single source file and then build a console program directly from that source file. This method is generally useful only for relatively simple programs.

To build a console program from a single source file

  1. Close any open project workspace.

  2. Create or open a source file in a text editor window.

  3. On the Build menu, click Build.

  4. In the message box, click Yes.

  5. If necessary, give the source file a new name, with an extension for a file that Visual C++ can build, such as .CPP.

    If you don't use a valid file extension, Visual C++ does not build anything because it cannot find a type of source file in the project to build.

  6. Click OK.

Visual C++ creates a default project workspace using the base name of the source file as the base name for the project. It uses default settings for a console program for the project configuration and builds the program.