Errors C++

Error C2628 Example 1: x' followed by 'x' is illegal

This type of error is generated by the common mistake of forgetting to put the semicolon at the end of the class declaration. In this simple example, there is only one file in the project (main.cpp) and the error is relatively easy to find. In a more typical project, a header that is missing a semicolon can be included in multiple other files, where the errors will often be difficult to understand. To find the mistake, look at the included headers files and make sure that a semicolon is present.

Code with Errors:

Code with errors

Compiler Error Message:

1>------ Build started: Project: myproj, Configuration: Debug Win32 ------
1>  main.cpp
1>c:\xoax.net\myproj\myproj\main.cpp(5): error C2039: 'end1' : is not a member of 'std'
1>c:\xoax.net\myproj\myproj\main.cpp(5): error C2065: 'end1' : undeclared identifier
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Fixed Code:

Fixed code

Output:

C2628 Example 1 Output
 

© 2007–2024 XoaX.net LLC. All rights reserved.