Share via


Building a Project (C+)

In this step, you deliberately introduce a Visual C++ syntax error in your code to see what a compilation error looks like and how to fix it. When you compile the project, an error message indicates what the problem is and where it occurred.

Prerequisites

This topic assumes that you understand the fundamentals of the C++ language.

To fix compilation errors using the IDE

  1. In testgames.cpp, delete the semicolon in the last line so that it resembles this:

    return 0
    
  2. On the Build menu, click Build Solution.

  3. A message in the Output window indicates that building the project failed.

    Click on the Go To Next Message button (the green, right-pointing arrow) in the Output window. The error message in the Output window and status bar area indicates there is a missing semicolon before the closing brace.

    To view more help information about an error, highlight the error and press the F1 key.

  4. Add the semicolon back to the end of the line with the syntax error:

    return 0;
    
  5. On the Build menu, click Build Solution.

    A message in the Output window indicates that the project compiled correctly.

Next Steps

Previous:Projects and Solutions (C+) | Next:Testing a Project (C+)

See Also

Tasks

Visual C++ Guided Tour

Other Resources

Building, Debugging, and Testing