VisualC++ 6.0: Method I - Using Visual C++ to create/compile/execute for a single file program

  1. Under File menu: New > File > C++ Source File

  2. Click on Location to select a directory( = folder) where the new file will be created.
  3. Type in a name for the new file; e.g., example1.cpp.
  4. Click OK.
  5. Cursor should appear in a window. Type in your program
  6. Under the Build menu, select Build.
  7. A Dialog window will ask "This build command requires an active project workspace. Would you like to create one?" Click OK.
  8. You will also be prompted to save changes to your file if you have not already. Click OK.
  9. This will try to compile and link your program to produce an executable file (named example1.exe in this case)
  10. There may be errors. These will appear in a bottom window.
  11. The error screen can be scrolled. Scroll back to find the first error in the bottom window. It will usually begin with the complete path name of your file with a line number in parentheses. Double clicking on this line will move the cursor to the corresponding line in your source code.
  12. Try to determine what the problem is, fix it, and ignore the remaining errors if any, and click on Build again.
  13. Repeat until no compilation errors are reported.
  14. To run the executable program just built, again click on the Build menu and select Execute.

VisualC++ 6.0: Method II - First create a Project

  1. Under File menu: New > Project > Win32 Console Application
  2. Click on Location to select a parent directory( = folder) where the new project directory will be created.
  3. Type in a name for the new project directory; e.g., project1
  4. Click OK. A "Workspace 'project1' window should appear. Near the bottom of this window there will be a ClassView tab and a FileView tab.
  5. As before, you can now create a new C++ source file.
  6. Click on the FileView Tab. You should see a "tree" diagram with three folder icons for "Source Files", "Header Files", and "Resource Files". Right click on Source Files and select "Add Files to Folder" and select the new file you just created.
  7. Under the Build menu, select Build.
  8. The remaining steps are the same as in the first method.

VisualC++.NET

  1. Start VisualStudio.Net. Click "New Project"
  2. In the dialog that opens, in the window labeled "Project types" locate VisualC++ Projects and select it.
  3. The right window of the dialog, labeled "Templates" will show a number of choices for this kind of project. Choose "Empty Project" (NOT "Win32 Console Project" and NOT "Win32 Project")
  4. On the same dialog window use the button labeled "Browse..." to select a directory( = folder) to hold VisualC++ projects
  5. Next type in a name for "this" project in the "Name:" text box and click OK.
  6. A window should be created - "Solution Explorer - name of your project". Below this Explorer window will have a tree diagram with three folder icos for "Source Files", "Header Files", and "Resource Files". Right click on Source Files and select "Add New Item". A dialog window will open with choices of what to add.
  7. On the left of this dialog expand the "Visual C++" tree node and select "Code". In the right window, you should see a number of choices. Select "C++ File", then type in a name for your file in the "Name:" textbox. The name should end with ".cpp". E.g., hello.cpp. Click the "Open" button.
  8. A window will open ready for you to write your program.
  9. When you have finished writting the program. Click on the "Build" menu and select the "Build Solution" item. This will begin compilation and linking (if no compile errors). An "Output" window should appear and show the compilation progress. If all goes well, you should see this message:
    Build: 1 succeeded, 0 failed, 0 skipped
  10. There may be errors. These will appear in the output window at the bottom.
  11. The error screen can be scrolled. Scroll back to find the first error in the bottom window. Find the line with the name of your file with a line number in parentheses. Double clicking on this line will move the cursor to the corresponding line in your source code.
  12. If errors occur, locate and fix them, then Build again.
  13. To execute the program, click on the "Debug" Menu and select "Start without debugging"