description | title | ms.date | helpviewer_keywords | ms.assetid | |||
---|---|---|---|---|---|---|---|
Learn more about: Walkthrough: Building a Project (C++) |
Walkthrough: Building a Project (C++) |
04/25/2019 |
|
d459bc03-88ef-48d0-9f9a-82d17f0b6a4d |
In this walkthrough, you deliberately introduce a C++ syntax error in your code to learn 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.
-
This walkthrough assumes that you understand the fundamentals of the C++ language.
-
It also assumes that you've completed the earlier related walkthroughs that are listed in Using the Visual Studio IDE for C++ Desktop Development.
-
In Game.cpp, delete the semicolon in the last line so that it resembles the statement:
return 0
-
On the menu bar, choose Build > Build Solution.
-
A message in the Error List window indicates that there was an error in the building of the project. The description looks something like the error message:
error C2143: syntax error: missing ';' before '}'
To view help information about this error, highlight it in the Error List window and then choose the F1 key.
-
Add the semicolon back to the end of the line that has the syntax error:
return 0;
-
On the menu bar, choose Build > Build Solution.
A message in the Output window indicates that the project compiled successfully.
1>------ Build started: Project: Game, Configuration: Debug Win32 ------ 1>Game.cpp 1>Game.vcxproj -> C:\Users\<username>\source\repos\Game\Debug\Game.exe ========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
Previous: Walkthrough: Working with Projects and Solutions (C++)
Next: Walkthrough: Testing a Project (C++)